mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-22 01:16:17 +08:00
18 lines
589 B
C#
18 lines
589 B
C#
using System.Application.Entities;
|
|
|
|
namespace System.Application.Repositories
|
|
{
|
|
public interface IGetPrimaryKey<TEntity> where TEntity : class
|
|
{
|
|
object GetPrimaryKey(TEntity entity);
|
|
}
|
|
|
|
public interface IGetPrimaryKey<TEntity, TPrimaryKey> : IGetPrimaryKey<TEntity>
|
|
where TEntity : class, IEntity<TPrimaryKey>
|
|
where TPrimaryKey : IEquatable<TPrimaryKey>
|
|
{
|
|
public new TPrimaryKey GetPrimaryKey(TEntity entity) => DefaultGetPrimaryKey(entity);
|
|
|
|
protected static TPrimaryKey DefaultGetPrimaryKey(TEntity entity) => entity.Id;
|
|
}
|
|
} |