Using MVC4, Entity Framework 5, I would ideally like every type to utilise an interface,
So I have my interfaces, one with a 'navigation' property to the other;
interface Ifoo has:
IUser User {get; set;}
int UserID {get; set;}
Lets say IUser only has UserID and UserName properties.
When implementing the Ifoo interface in a type, I use
public Iuser User {get; set;}
public UserID {get; set;}
Then, using EF5, I eager load the navigation propert, using my User type, which implements IUser:
db.Foo.where(x => x.id == id).Include(x => x.User)
But It tells me that:
A specified Include path is not valid. The EntityType 'Dal.Foo' does not declare a navigation property with the name 'User'.
However, If I change both the interfaces to implement the type directly, it works fine.
Is there a way around this so I can utilise interfaces?