Is there a way to find Key Members of an entity (TEntity) when using CodeFirst (DbContext) on a generic context similar to ObjectContext?
I can see how it's done using ObjectContext here.
Is there a way to find Key Members of an entity (TEntity) when using CodeFirst (DbContext) on a generic context similar to ObjectContext?
I can see how it's done using ObjectContext here.
I'm sorry for the confusion, it seems like even with Code First approach we can find the key members on an entity using the object context as shown below:
var ObjectContext = ((IObjectContextAdapter)DbContext).ObjectContext;
var ObjectSet = ObjectContext .CreateObjectSet<TEntity>();
var EntitySet = ObjectSet.EntitySet;
var KeyMembers = EntitySet.ElementType.KeyMembers;