mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-11-07 16:40:29 +08:00
29 lines
658 B
C#
29 lines
658 B
C#
using OpenAuth.Repository.Core;
|
|
using SqlSugar;
|
|
|
|
namespace OpenAuth.Repository
|
|
{
|
|
/// <summary>
|
|
/// SqlSugar仓储
|
|
/// <para>具体用法参考:https://www.donet5.com/Home/Doc?typeId=1228</para>
|
|
/// </summary>
|
|
public class SqlSugarRepository<T> : SimpleClient<T> where T : BaseEntity, new()
|
|
{
|
|
public SqlSugarRepository(ISqlSugarClient client)
|
|
{
|
|
base.Context = client;
|
|
}
|
|
|
|
public new bool Insert(T entity)
|
|
{
|
|
if (entity.KeyIsNull())
|
|
{
|
|
entity.GenerateDefaultKeyVal();
|
|
}
|
|
|
|
return base.Insert(entity);
|
|
}
|
|
}
|
|
}
|
|
|