Skip to main content

RepositoryExtensions.ProjectionHasPrimaryKey<TEntity, TProjection, TPrimaryKey>(IRepository<TEntity, TPrimaryKey>, TProjection) Method

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

Namespace: DevExpress.Mvvm.DataModel

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

NuGet Package: DevExpress.Scaffolding.Core

Declaration

public static bool ProjectionHasPrimaryKey<TEntity, TProjection, TPrimaryKey>(
    this IRepository<TEntity, TPrimaryKey> repository,
    TProjection projectionEntity
)
    where TEntity : class

Parameters

Name Type Description
repository IRepository<TEntity, TPrimaryKey>

A repository.

projectionEntity TProjection

An entity.

Type Parameters

Name
TEntity
TProjection
TPrimaryKey

Returns

Type Description
Boolean

true if the given entity has the primary key assigned; otherwise, false.

Remarks

The ProjectionHasPrimaryKey<TEntity, TProjection, TPrimaryKey> function always returns true if the primary key is a non-nullable value type.

See Also