mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
Add English comments.
This commit is contained in:
parent
6789c3f3ee
commit
902f1e45f1
@ -14,6 +14,8 @@ using System.Threading;
|
||||
namespace FreeSql
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity base class, including CreateTime/UpdateTime/IsDeleted.
|
||||
/// <para></para>
|
||||
/// 包括 CreateTime/UpdateTime/IsDeleted 的实体基类
|
||||
/// </summary>
|
||||
[Table(DisableSyncStructure = true)]
|
||||
@ -28,23 +30,24 @@ BaseEntity.Initialization(new FreeSqlBuilder()
|
||||
.Build());";
|
||||
|
||||
/// <summary>
|
||||
/// 全局 IFreeSql orm 对象
|
||||
/// Global IFreeSql ORM Object <br />
|
||||
/// 全局 IFreeSql ORM 对象
|
||||
/// </summary>
|
||||
public static IFreeSql Orm => _ormPriv ?? throw new Exception(ErrorMessageTemplate);
|
||||
|
||||
internal static Func<IUnitOfWork> _resolveUow;
|
||||
|
||||
/// <summary>
|
||||
/// To initialize the BaseEntity <br />
|
||||
/// 初始化 BaseEntity
|
||||
/// BaseEntity.Initialization(new FreeSqlBuilder()
|
||||
/// <para></para>
|
||||
/// .UseAutoSyncStructure(true)
|
||||
/// <para></para>
|
||||
/// .UseConnectionString(DataType.Sqlite, "data source=test.db;max pool size=5")
|
||||
/// <para></para>
|
||||
/// BaseEntity.Initialization( <br />
|
||||
/// new FreeSqlBuilder() <br />
|
||||
/// .UseAutoSyncStructure(true) <br />
|
||||
/// .UseConnectionString(DataType.Sqlite, "data source=test.db;max pool size=5") <br />
|
||||
/// .Build());
|
||||
/// </summary>
|
||||
/// <param name="fsql">IFreeSql orm 对象</param>
|
||||
/// <param name="fsql">IFreeSql ORM Object</param>
|
||||
/// <param name="resolveUow">工作单元(事务)委托,如果不使用事务请传 null<para></para>解释:由于AsyncLocal平台兼容不好,所以交给外部管理</param>
|
||||
public static void Initialization(IFreeSql fsql, Func<IUnitOfWork> resolveUow)
|
||||
{
|
||||
@ -83,34 +86,45 @@ BaseEntity.Initialization(new FreeSqlBuilder()
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Created time <br />
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Column(Position = -4)]
|
||||
public virtual DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Updated time <br />
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[Column(Position = -3)]
|
||||
public virtual DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Logical Delete <br />
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
[Column(Position = -2)]
|
||||
public virtual bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sort <br />
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Column(Position = -1)]
|
||||
public virtual int Sort { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A readonly entity base class, including CreateTime/UpdateTime/IsDeleted.
|
||||
/// <para></para>
|
||||
/// 包括 CreateTime/UpdateTime/IsDeleted 的只读实体基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
[Table(DisableSyncStructure = true)]
|
||||
public abstract class BaseEntityReadOnly<TEntity> : BaseEntity where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// To query data <br />
|
||||
/// 查询数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
@ -189,14 +203,22 @@ BaseEntity.Initialization(new FreeSqlBuilder()
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件,Where(a => a.Id > 10),支持导航对象查询,Where(a => a.Author.Email == "2881099@qq.com")
|
||||
/// Query conditions <br />
|
||||
/// 查询条件,Where(a => a.Id> 10)
|
||||
/// <para></para>
|
||||
/// Support navigation object query <br />
|
||||
/// 支持导航对象查询,Where(a => a.Author.Email == "2881099@qq.com")
|
||||
/// </summary>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
/// <returns></returns>
|
||||
public static ISelect<TEntity> Where(Expression<Func<TEntity, bool>> exp) => Select.Where(exp);
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件,Where(true, a => a.Id > 10),支导航对象查询,Where(true, a => a.Author.Email == "2881099@qq.com")
|
||||
/// Query conditions <br />
|
||||
/// 查询条件,Where(true, a => a.Id > 10)
|
||||
/// <para></para>
|
||||
/// Support navigation object query <br />
|
||||
/// 支导航对象查询,Where(true, a => a.Author.Email == "2881099@qq.com")
|
||||
/// </summary>
|
||||
/// <param name="condition">true 时生效</param>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
@ -204,12 +226,14 @@ BaseEntity.Initialization(new FreeSqlBuilder()
|
||||
public static ISelect<TEntity> WhereIf(bool condition, Expression<Func<TEntity, bool>> exp) => Select.WhereIf(condition, exp);
|
||||
|
||||
/// <summary>
|
||||
/// Repository object. <br />
|
||||
/// 仓储对象
|
||||
/// </summary>
|
||||
protected IBaseRepository<TEntity> Repository { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附加实体,在更新数据时,只更新变化的部分
|
||||
/// To Attach entities. When updating data, only the changed part is updated. <br />
|
||||
/// 附加实体。在更新数据时,只更新变化的部分
|
||||
/// </summary>
|
||||
public TEntity Attach()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user