using System.Application.Entities; namespace System.Application.Repositories { public interface IGetPrimaryKey where TEntity : class { object GetPrimaryKey(TEntity entity); } public interface IGetPrimaryKey : IGetPrimaryKey where TEntity : class, IEntity where TPrimaryKey : IEquatable { public new TPrimaryKey GetPrimaryKey(TEntity entity) => DefaultGetPrimaryKey(entity); protected static TPrimaryKey DefaultGetPrimaryKey(TEntity entity) => entity.Id; } }