mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 增加 IUnitOfWork Orm 属性直接访问 IFreeSql CRUD 事务与工作单元一致;
This commit is contained in:
parent
7cc3374054
commit
aa187eb18a
@ -125,6 +125,13 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||||
|
<summary>
|
||||||
|
根据 lambda 条件删除数据
|
||||||
|
</summary>
|
||||||
|
<param name="predicate"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
@ -479,5 +486,14 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||||
|
<summary>
|
||||||
|
批量注入 Repository,可以参考代码自行调整
|
||||||
|
</summary>
|
||||||
|
<param name="services"></param>
|
||||||
|
<param name="globalDataFilter"></param>
|
||||||
|
<param name="assemblies"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -10,6 +10,7 @@ namespace FreeSql
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IUnitOfWork : IDisposable
|
public interface IUnitOfWork : IDisposable
|
||||||
{
|
{
|
||||||
|
IFreeSql Orm { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开启事务,或者返回已开启的事务
|
/// 开启事务,或者返回已开启的事务
|
||||||
@ -27,7 +28,7 @@ namespace FreeSql
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用工作单元
|
/// 是否启用工作单元
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("即将删除(保留到2020-08-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
[Obsolete("即将删除(保留到2020-12-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
||||||
bool Enable { get; }
|
bool Enable { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -36,13 +37,13 @@ namespace FreeSql
|
|||||||
/// <para></para>
|
/// <para></para>
|
||||||
/// 若已开启事务(已有Insert/Update/Delete操作),调用此方法将发生异常,建议在执行逻辑前调用
|
/// 若已开启事务(已有Insert/Update/Delete操作),调用此方法将发生异常,建议在执行逻辑前调用
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("即将删除(保留到2020-08-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
[Obsolete("即将删除(保留到2020-12-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开启工作单元
|
/// 开启工作单元
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("即将删除(保留到2020-08-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
[Obsolete("即将删除(保留到2020-12-01),请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
|
||||||
void Open();
|
void Open();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -64,6 +64,9 @@ namespace FreeSql
|
|||||||
Enable = true;
|
Enable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbContextScopedFreeSql _ormScoped;
|
||||||
|
public IFreeSql Orm => _ormScoped ?? (_ormScoped = DbContextScopedFreeSql.Create(_fsql, null, () => this));
|
||||||
|
|
||||||
public IsolationLevel? IsolationLevel { get; set; }
|
public IsolationLevel? IsolationLevel { get; set; }
|
||||||
|
|
||||||
public DbTransaction GetOrBeginTransaction(bool isCreate = true)
|
public DbTransaction GetOrBeginTransaction(bool isCreate = true)
|
||||||
|
@ -184,6 +184,7 @@ namespace FreeSql
|
|||||||
IUnitOfWork _baseUow;
|
IUnitOfWork _baseUow;
|
||||||
internal Action OnDispose;
|
internal Action OnDispose;
|
||||||
public UnitOfWorkOrginal(IUnitOfWork baseUow) => _baseUow = baseUow;
|
public UnitOfWorkOrginal(IUnitOfWork baseUow) => _baseUow = baseUow;
|
||||||
|
public IFreeSql Orm => _baseUow.Orm;
|
||||||
public IsolationLevel? IsolationLevel { get => _baseUow.IsolationLevel; set => _baseUow.IsolationLevel = value; }
|
public IsolationLevel? IsolationLevel { get => _baseUow.IsolationLevel; set => _baseUow.IsolationLevel = value; }
|
||||||
public DbContext.EntityChangeReport EntityChangeReport => _baseUow.EntityChangeReport;
|
public DbContext.EntityChangeReport EntityChangeReport => _baseUow.EntityChangeReport;
|
||||||
|
|
||||||
@ -205,6 +206,7 @@ namespace FreeSql
|
|||||||
IUnitOfWork _baseUow;
|
IUnitOfWork _baseUow;
|
||||||
internal Action OnDispose;
|
internal Action OnDispose;
|
||||||
public UnitOfWorkVirtual(IUnitOfWork baseUow) => _baseUow = baseUow;
|
public UnitOfWorkVirtual(IUnitOfWork baseUow) => _baseUow = baseUow;
|
||||||
|
public IFreeSql Orm => _baseUow.Orm;
|
||||||
public IsolationLevel? IsolationLevel { get => _baseUow.IsolationLevel; set { } }
|
public IsolationLevel? IsolationLevel { get => _baseUow.IsolationLevel; set { } }
|
||||||
public DbContext.EntityChangeReport EntityChangeReport => _baseUow.EntityChangeReport;
|
public DbContext.EntityChangeReport EntityChangeReport => _baseUow.EntityChangeReport;
|
||||||
|
|
||||||
@ -222,6 +224,7 @@ namespace FreeSql
|
|||||||
internal IFreeSql _fsql;
|
internal IFreeSql _fsql;
|
||||||
internal Action OnDispose;
|
internal Action OnDispose;
|
||||||
public UnitOfWorkNothing(IFreeSql fsql) => _fsql = fsql;
|
public UnitOfWorkNothing(IFreeSql fsql) => _fsql = fsql;
|
||||||
|
public IFreeSql Orm => _fsql;
|
||||||
public IsolationLevel? IsolationLevel { get; set; }
|
public IsolationLevel? IsolationLevel { get; set; }
|
||||||
public DbContext.EntityChangeReport EntityChangeReport { get; } = new DbContext.EntityChangeReport();
|
public DbContext.EntityChangeReport EntityChangeReport { get; } = new DbContext.EntityChangeReport();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user