I am trying to find a User entity in my “Domain Entity” DB Set.
The User entity is derived from a base type called Domain Entity.
I want to use the following to find a user according to his ID
User userToDelte = db.DomainEntities.OfType<User>().Find(UserID);
But I get a compiler error :
‘System.Linq.IQueryable’ does not
contain a definition for ‘Find’ and no extension method ‘Find’
accepting a first argument of type…
Why can’t I use Find() after I have used OfType<User>() ?
P.S
It is important for me to get a strongly typed User entity because it has a navigation propertiy that include all of it’s details in a separate table called “UserDetails” along with the user name and password.
That is because Find method is declared in
DbSetnotSystem.Linq.IQueryable. Instead of that use the Set method ofDbContextto create theDbSet.