mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
24 lines
587 B
C#
24 lines
587 B
C#
namespace OpenAuth.Repository.Core
|
|
{
|
|
public abstract class BaseEntity
|
|
{
|
|
/// <summary>
|
|
/// 判断主键是否为空,常用做判定操作是【添加】还是【编辑】
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public abstract bool KeyIsNull();
|
|
|
|
/// <summary>
|
|
/// 创建默认的主键值
|
|
/// </summary>
|
|
public abstract void GenerateDefaultKeyVal();
|
|
|
|
public BaseEntity()
|
|
{
|
|
if (KeyIsNull())
|
|
{
|
|
GenerateDefaultKeyVal();
|
|
}
|
|
}
|
|
}
|
|
} |