mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 优化 DbContext/Repository Orm 属性进行 CURD 与自身事务相同【新突破】;#270
This commit is contained in:
@ -23,14 +23,14 @@ namespace FreeSql
|
||||
{
|
||||
throw new Exception($"AddFreeDbContext 发生错误,请检查 {dbContextType.Name} 的构造参数都已正确注入", ex);
|
||||
}
|
||||
if (ctx != null && ctx._ormPriv == null)
|
||||
if (ctx != null && ctx._ormScoped == null)
|
||||
{
|
||||
var builder = new DbContextOptionsBuilder();
|
||||
options(builder);
|
||||
ctx._ormPriv = builder._fsql;
|
||||
ctx._ormScoped = DbContextScopedFreeSql.Create(builder._fsql, () => ctx, () => ctx.UnitOfWork);
|
||||
ctx._optionsPriv = builder._options;
|
||||
|
||||
if (ctx._ormPriv == null)
|
||||
if (ctx._ormScoped == null)
|
||||
throw new Exception("请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql");
|
||||
|
||||
ctx.InitPropSets();
|
||||
|
Reference in New Issue
Block a user