c# - Can one implement an interface property on an Entity Object interface? -



c# - Can one implement an interface property on an Entity Object interface? -

i'm using entity framework , have created interface lease transactions:

public interface ileasetransaction { int id { get; } datetime date { get; } decimal amount { get; } }

then implement interface on entity object created empty partial class:

public partial class type1leasetransaction : ileasetransaction { }

this works fine, transactions can have 0 or 1 voids entity objects. attempted implement voids follows:

public interface ileasetransactionvoid { int transactionid { get; } datetime date { get; } int typeid { get; } }

and empty partial class...:

public partial class type1leasetransactionvoid : ileasetransactionvoid { }

the problem running when seek add together ileasetransactionvoid property leasetransaction interface:

public interface ileasetransaction { int id { get; } datetime date { get; } decimal amount { get; } ileasetransactionvoid void { get; } // throws error }

when seek , build next error:

'domainmodel.models.type1leasetransaction' not implement interface fellow member 'domainmodel.abstract.ileasetransaction.void'. 'domainmodel.models.type1leasetransaction.void' cannot implement 'domainmodel.abstract.ileasetransaction.void' because not have matching homecoming type of 'domainmodel.abstract.ileasetransactionvoid'.

i guess error makes sense since homecoming type isn't interface though implement interface. i'm new i'm lost @ point.

is there way me implement nested interface property ileasetransactionvoid on ileasetransaction?

thank you!

so didn't seem popular, did manage find reply finds useful 1 day:

the solution maintain interface signature same above:

public interface ileasetransaction { int id { get; } datetime date { get; } decimal amount { get; } ileasetransactionvoid void { get; } // throws error }

and alter way entity class implements interface adding interface-specific property follows:

public partial class type1leasetransactionvoid : ileasetransactionvoid { ileasetransactionvoid ileasetransaction.void { { homecoming (ileasetransactionvoid)void; } } }

c# .net entity-framework interface

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -