- 优化 DbContext/Repository Orm 属性进行 CURD 与自身事务相同【新突破】;#270

This commit is contained in:
28810
2020-04-10 19:54:43 +08:00
parent d97dc3383c
commit 52fbe5ed86
17 changed files with 3884 additions and 3849 deletions

View File

@ -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();