design by contract - How do I get Entity Framework to use interfaces on the generated classes? -
I have a project where the client is using the Entity Framework, and I want to remove the generated class from the rest I am trying to apply.
There is an income class category and it calls the form as a property.
I have created an interface that I want to apply the class like:
Public Interface ICategory {string type {get; Set;}}
I did it before SQL in SQL and it works fine. I am creating a partial class in a separate file and I am implementing the interface:
public partial category category: iCATTAR // applicable interface
However, whenever EF tries to make a query with EF, then it says that type the type
Example:
var query = from DataContext in the c category where type == select "some type" c; Var resultsList = query.OfType & lt; ICATT & gt; (); // error here (not supported)
What am I doing wrong here?
By keeping in mind the other things: I am developing it in silver applications and data. The reference is being pulled from a service, hence there is a customer server connection here too. .
As a general rule, LINQ can only understand the units that your unit Models (ADMX) are part of. So when you are free to expand your unit types, there are partial classes, you can not use properties, methods, and interface references that add you to unit queries in LINQ, however
< P> However, in this case the following questions should give you the results you want: var resultsList = query.Select & lt; ICategory & gt; (C = & gt; c);
Comments
Post a Comment