Skip to main content

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.v23.2.DataModel.dll

NuGet Package: DevExpress.Scaffolding.Core

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