linq2db integration with Entity Framework Core and dbContext.GetCte missing

380 views Asked by At

linq2db has possibility to "integrate" with EF Core context:

EF Core integration

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

There are 1 answers

0
Artur On BEST ANSWER

seems to work

using (var _dbContext = new CompanyContext())
{
    using (var db = _dbContext.CreateLinqToDBConnection())
    {

    }
}