Export (0) Print
Expand All

DbSet<TEntity>.Find Method

Entity Framework 5.0

Uses the primary key value to attempt to find an entity tracked by the context. If the entity is not in the context then a query will be executed and evaluated against the data in the data source, and null is returned if the entity is not found in the context or in the data source. Note that the Find also returns entities that have been added to the context but have not yet been saved to the database.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

public TEntity Find(
	params Object[] keyValues
)

Parameters

keyValues
Type: System.Object[]

The values of the primary key for the entity to be found.

Return Value

Type: TEntity
Returns Boolean.

Implements

IDbSet<TEntity>.Find(Object[])

The Find method takes an array of objects as an argument. When working with composite primary keys, pass the key values separated by commas and in the same order that they are defined in the model.

Show:
© 2014 Microsoft