We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seems that configuring context with AddLinqToDBContext has two ways to set DataContextOptions. One of which looses parameters.
AddLinqToDBContext
DataContextOptions
using System.Diagnostics; using Microsoft.Extensions.DependencyInjection; using LinqToDB; using LinqToDB.Data; using LinqToDB.AspNet; using LinqToDB.DataProvider.SqlServer; namespace ConsoleApp1; internal sealed class DbContext : DataConnection { public DbContext(DataOptions options) : base(options) { Debug.Assert(options.DataContextOptions.CommandTimeout == 91); // always ok Debug.Assert(CommandTimeout == 91); // failing } } static class Program { static void Main() { var services = new ServiceCollection(); services.AddLinqToDBContext<DbContext>((provider, options) => { return options .UseSqlServer("some conn string", SqlServerVersion.v2019, SqlServerProvider.MicrosoftDataSqlClient) .WithOptions<DataContextOptions>(o => o with { CommandTimeout = 91 }) // this failing // .WithOptions(options.DataContextOptions with { CommandTimeout = 91 }) // this works ; }); var container = services.BuildServiceProvider(); container.GetService<DbContext>(); System.Console.WriteLine("Ok"); } }
Linq To DB version: 5.4.1
Linq To DB
Database (with version): SQL Server 2019
ADO.NET Provider (with version): Microsoft.Data.SqlClient 5.20
Operating system: Windows 10
.NET Version: .NET Core 6
The text was updated successfully, but these errors were encountered:
Fixed #4476.
2779756
#4476 Simplified the fix.
e5dfcd5
igor-tkachev
Successfully merging a pull request may close this issue.
Describe your issue
Seems that configuring context with
AddLinqToDBContext
has two ways to setDataContextOptions
. One of which looses parameters.Environment details
Linq To DB
version: 5.4.1Database (with version): SQL Server 2019
ADO.NET Provider (with version): Microsoft.Data.SqlClient 5.20
Operating system: Windows 10
.NET Version: .NET Core 6
The text was updated successfully, but these errors were encountered: