I'm using Entity Framework and I have created an interface for lease transactions:
public interface ILeaseTransaction
{
int ID { get; }
DateTime Date { get; }
decimal Amount { get; }
}
Then to implement the interface on the Entity Object I created an empty partial class:
public partial class Type1LeaseTransaction : ILeaseTransaction
{
}
This works fine, however transactions can also have zero or one Voids which are also Entity Objects. I attempted to implement the Voids as follows:
public interface ILeaseTransactionVoid
{
int TransactionID { get; }
DateTime Date { get; }
int TypeID { get; }
}
And the empty partial class...:
public partial class Type1LeaseTransactionVoid : ILeaseTransactionVoid
{
}
The problem I am running into is when I try to add the ILeaseTransactionVoid as a property to the LeaseTransaction interface:
public interface ILeaseTransaction
{
int ID { get; }
DateTime Date { get; }
decimal Amount { get; }
ILeaseTransactionVoid Void { get; } // This throws an error
}
When I try and build I get the following error:
'DomainModel.Models.Type1LeaseTransaction' does not implement interface member 'DomainModel.Abstract.ILeaseTransaction.Void'. 'DomainModel.Models.Type1LeaseTransaction.Void' cannot implement 'DomainModel.Abstract.ILeaseTransaction.Void' because it does not have the matching return type of 'DomainModel.Abstract.ILeaseTransactionVoid'.
I guess the error makes sense since the return type isn't the interface itself even though it does implement the interface. I'm new to all this so I'm completely lost at this point.
Is there any way for me to implement the nested interface property ILeaseTransactionVoid on ILeaseTransaction?
Thank you!