Skip to main content
A newer version of this page is available. .

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

Determines whether the given entity has the primary key assigned (the primary key is not null).

Namespace: DevExpress.Mvvm.DataModel

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

Declaration

bool HasPrimaryKey(
    TEntity entity
)

Parameters

Name Type Description
entity TEntity

An entity to test.

Returns

Type Description
Boolean

true if the given entity has the primary key assigned (the primary key is not null); otherwise, false.

Remarks

The HasPrimaryKey method always returns true if the primary key is a non-nullable value type.

See Also