英文:
linq2db integration with Entity Framework Core and dbContext.GetCte missing
问题
linq2db有与EF Core上下文集成的可能性:
> 在您的代码中,您需要使用以下调用来初始化集成:
> LinqToDBForEFTools.Initialize();
但在这行之后,EF Core上下文中没有GetCte
方法。
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=.; Database=dbName;User Id=sa; Password=ble; encrypt=false", options => options.CommandTimeout(10))
.LogTo(Console.WriteLine, new[] { DbLoggerCategory.Query.Name, DbLoggerCategory.Database.Connection.Name, DbLoggerCategory.Database.Name }
);
// .UseQueryTrackingBehavior( QueryTrackingBehavior.NoTracking);
LinqToDBForEFTools.Initialize();
}
使用
using (var _dbContext = new CompanyContext())
{
_dbContext.GetCte - 找不到
_dbContext.BulkCopy - 找到
}
是否可以在EF Core上下文中使用GetCte
,还是必须进行完整的linq2db配置才能使用递归CTE?
英文:
linq2db has possibility to "integrate" with EF Core context:
> In your code you need to initialize integration using following call:
> LinqToDBForEFTools.Initialize();
but after only that line there is no method GetCte
in EF Core context.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=.; Database=dbName;User Id=sa; Password=ble; encrypt=false", options => options.CommandTimeout(10))
.LogTo(Console.WriteLine, new[] { DbLoggerCategory.Query.Name, DbLoggerCategory.Database.Connection.Name, DbLoggerCategory.Database.Name }
);
// .UseQueryTrackingBehavior( QueryTrackingBehavior.NoTracking);
LinqToDBForEFTools.Initialize();
}
USING
using (var _dbContext = new CompanyContext())
{
_dbContext.GetCte - not found
_dbContext.BulkCopy - found
}
Is it possible to use GetCte
with EF Core DbContext
or linq2db full configuration should be done to have a possibility to use recursive CTE?
答案1
得分: 2
"seems to work" 意思是 "似乎工作正常"。
英文:
seems to work
using (var _dbContext = new CompanyContext())
{
using (var db = _dbContext.CreateLinqToDBConnection())
{
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论