You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DbContext pooling doesn't work if the DbContext has multiple constructors.
I think this is a bit too strict, as only one constructor is needed with exactly one parameter DbContextOptions.
An usecase for multiple constructors for example is with the tool Linqpad but you need to separate constructor to use it for Linqpad.
The error thrown is The DbContext of type '{contextType}' cannot be pooled because it does not have a public constructor accepting a single parameter of type DbContextOptions or has more than one constructor.
The check is present in DbContextPool.CreateActivator() and could be changed to only check if a constructor is available with 1 parameter of type typeof(DbContextOptions) || p.ParameterType == typeof(DbContextOptions<TContext>))
Describe the solution you'd like
No response
The text was updated successfully, but these errors were encountered:
What problem are you trying to solve?
DbContext pooling doesn't work if the DbContext has multiple constructors.
I think this is a bit too strict, as only one constructor is needed with exactly one parameter DbContextOptions.
An usecase for multiple constructors for example is with the tool Linqpad but you need to separate constructor to use it for Linqpad.
The error thrown is
The DbContext of type '{contextType}' cannot be pooled because it does not have a public constructor accepting a single parameter of type DbContextOptions or has more than one constructor.
The check is present in DbContextPool.CreateActivator() and could be changed to only check if a constructor is available with 1 parameter of type
typeof(DbContextOptions) || p.ParameterType == typeof(DbContextOptions<TContext>))
Describe the solution you'd like
No response
The text was updated successfully, but these errors were encountered: