Files
Yi.Framework/Yi.Framework.Net6/Yi.Framework.Model/Base/IEntity.cs
2023-01-01 23:51:05 +08:00

34 lines
1003 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Base
{
/// <summary>
/// Defines an entity. It's primary key may not be "Id" or it may have a composite primary key.
/// Use <see cref="IEntity{TKey}"/> where possible for better integration to repositories and other structures in the framework.
/// </summary>
public interface IEntity
{
/// <summary>
/// Returns an array of ordered keys for this entity.
/// </summary>
/// <returns></returns>
//object[] GetKeys();
}
/// <summary>
/// Defines an entity with a single primary key with "Id" property.
/// </summary>
/// <typeparam name="TKey">Type of the primary key of the entity</typeparam>
public interface IEntity<TKey> : IEntity
{
/// <summary>
/// Unique identifier for this entity.
/// </summary>
TKey Id { get; }
}
}