Is is possible to use a custom .NET data provider without installing it in the GAC?
Can I reference a custom DLL and register it inside my configuration file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can register an implementation of the DbProviderFactory class by adding the following section in your configuration file:
The
MyCustomDataProviderassembly doesn’t have to be registered in the GAC but can be deployed together with the application as a private assembly.You can refer to the registered data provider programmatically by using the value specified in the
invariantattribute. For example you could tell ADO.NET to use theMyNamespace.MyCustomProviderFactoryby specifyingMyCustomProvideras theproviderNamein the connection string:In code you can use the same provider name with the DbProviderFactories.GetFactory method:
where
factorywill be an instance of theMyNamespace.MyCustomProviderFactoryclass.