30% OFF - 10th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY10
Entity Framework Find Discover How to Find Entity By Key
Finds an entity with the given primary key values.
- If an entity with the given primary key values exists in the context, then it is returned immediately without requesting the store.
- Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned.
- If no entity is found in the context or the store, then null is returned.
using (var context = new BookStore()) { var authors = context.Authors .Find(2); }
ZZZ Projects