-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
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
API for Code based configuration for DBProviderFactories #16532
Comments
You should allow overriding the factory. Blocking that seems unnecessarily restrictive. |
@davidfowl I assume that your suggestion is about overriding the value of factory registration.
The reason why we don't allow for duplicate is to make the behavior less unpredictable. But the application can decide in advanced which provider they want to use and create their own policy to select which provider they want to use if there is a conflict. e.g File based config override mechanism based on folder hierarchy. |
Making it impossible though seems a bit restrictive. There's a thin line between trying to protect users from the scenarios "you can think will be confusing" and scenarios "you didn't anticipate would be useful". Blocking it because you can only think of a case that would confusing customers is bad. Another think I'd like from this API is the ability to new up a |
Does this mean that there ris no way to register a custom provider, say "Oracle.ManagedDataAccess.Client" on .NET 4.6.2? |
@gafemoyano Oracle.ManagedDataAccess.Client is not a .NET core compatible provider it is a full framework provider |
What is ADP here ? |
@KevalPatel please don't comment on old-closed issues. No one is likely monitoring them. I don't understand your question in this context, so can't answer. |
Problem
DbProviderFactories in .NET Framework provides an API to manage DbProviderFactory which configured in machine.config and load that assembly from GAC via reflection
In Corefx, there is no more GAC and machine.config.
Community are asking to have a standard way to manage DbProviderFactory to write provider agnostic code in libraries.
https://github.com/dotnet/corefx/issues/4571
https://github.com/dotnet/corefx/issues/5782
https://msdn.microsoft.com/en-us/library/ms971499.aspx
Proposal
We will bring back DbProviderFactories in CoreFx.
But instead of register/read the configuration from machine.config, we will provide a code based configuration.
This will allow application writer to hook this with any configuration mechanism.
Contract Changes
We will bring back DbProviderFactories.GetFactory functions in V1 contract which will support .Net 4.6.2.
And add "RegisterFactory" functions in V2 contract to support .Net vNext. (version after 4.6.2)
For portability, we will bring "RegisterFactory" into .Net vNext and should work side by side with file config behavior. e.g code based config will override file based config).
Portable library (such as ORM), can start using GetFactory and target it for .Net 4.6.2.
If this library used in .NET 4.6.2 , GetFactory will return factory which defined in machine/app configs.
Corefx application which used this portable library can register their factory using "RegisterFactory".
Once we release "RegisterFactory" into .Net vNext, The behavior will be work seamless in both frameworks.
DbProviderFactories
CoreFx Implementation
Usage
For CoreFX application, You need to register your provider factory during startup of your application.
Progress
I have created initial commit on my branch to inspect what are the changes needed.
kkurni/corefx@68380b3
The text was updated successfully, but these errors were encountered: