Skip to main content

IRepository<TEntity, TPrimaryKey>.Find(TPrimaryKey) Method

Finds an entity with the given primary key value.

Namespace: DevExpress.Mvvm.DataModel

Assembly: DevExpress.Mvvm.v24.1.DataModel.dll

NuGet Package: DevExpress.Scaffolding.Core

Declaration

TEntity Find(
    TPrimaryKey primaryKey
)

Parameters

Name Type Description
primaryKey TPrimaryKey

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

Returns

Type Description
TEntity

The entity with the given primary key value. null if no entity is found.

Remarks

If an entity with the given primary key value exists in the unit of work, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key value and this entity, if found, is attached to the unit of work and returned.

If no entity is found in the unit of work or the store, then null is returned.

See Also