OpenAuth.Net/OpenAuth.Repository/SqlSugarRepository.cs

29 lines
658 B
C#
Raw Normal View History

2025-06-26 21:02:11 +08:00
using OpenAuth.Repository.Core;
using SqlSugar;
2023-08-27 00:23:45 +08:00
namespace OpenAuth.Repository
2023-08-27 00:23:45 +08:00
{
/// <summary>
/// SqlSugar仓储
/// <para>具体用法参考https://www.donet5.com/Home/Doc?typeId=1228</para>
/// </summary>
2025-06-26 21:02:11 +08:00
public class SqlSugarRepository<T> : SimpleClient<T> where T : BaseEntity, new()
{
public SqlSugarRepository(ISqlSugarClient client)
{
base.Context = client;
}
2025-06-26 21:02:11 +08:00
public new bool Insert(T entity)
{
if (entity.KeyIsNull())
{
entity.GenerateDefaultKeyVal();
}
return base.Insert(entity);
}
2023-08-27 00:23:45 +08:00
}
}