How to get a MetadataProvdier working with the latest version of DB Provider?
> I am getting the following error:
"Could not load file or assembly 'xxx' or one of its dependencies. The system cannot find the file specified."
> Do I have to use that specific version?
> I would like to use a new version!
Usually, this problem appears when you try to set a Connection property for one of the MetadataProvider objects that refer to a third-party .NET DB provider assembly.
There are two ways to solve the problem:
1. Assign the Connection property in code.
You cannot set this property in Visual Studio as the IDE itself loads assemblies without the binding redirection, but Visual Studio automatically adds it to the 'app.config' or 'web.config' file of your project, so the same operation will work in runtime. Thus, you can assign your DB provider to the Connection property in code and that will work just fine!
Note: Automatic binding redirection should be turned on or manual assembly binding redirection should be set up properly. Please read these MSDN articles for details:
A great article explaining "what should I do if" can be found here: Assembly Binding Redirect to a lower version.
2. Recompile the source code of a metadata provider with the right version of .NET DB Provider.
Source code of all metadata providers are available in all versions, including the trial version, so you can recompile the needed providers with those versions of DB providers that you have (and the needed version of .NET Framework), or you can simply include a source code project of necessary metadata providers right into your solution.
You can find the source code in the "%USERPROFILE%\Documents\Active Query Builder 3.x .NET Source Code" folder.