How to fix the "Code generation for property 'Connection' failed" error?
Metadata provider for third-party DB connection may fail to load if you add an instance of it to the form due to the release of a newer version of this DB connection assembly. It happens because of the lack of assembly binding redirection, not in your project, but in the Visual Studio IDE itself.
To avoid such problems we regularly update references to third-party assemblies in our metadata providers. The problem is that we have to make this manually as newer versions of third-party assemblies may drop support for older framework versions that we claim to support. After we update this reference in the metadata provider, this error disappears but this situation may happen again in the future.
To avoid this error completely, you should create instances of such metadata providers in run-time. Assembly binding redirection is turned on by default, so this way you won't have this error on assigning your DB connection to the MetadataProvider.Connection property.