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