I have a set of POCO classes which implement IConnectable
and IEntity
.
In one of the classes, Connection
, I want two properties that are defined as objects that implement IConnectable
.
public interface IConnectable
{
string Name { get; set; }
string Url { get; set; }
}
And my connection class
public partial class Connection : IEntity
{
public int Id { get; set; }
public T<IConnectable> From { get; set; }
public T<IConnectable> To { get; set; }
public ConnectionType Type { get; set; }
public double Affinity { get; set; }
public DateTimeOffset CreatedOn { get; set; }
}
I know I can't use generic objects are properties -- so is there any other way to do this?