I am using database first and reading in the configuration string from app.config. When I attempt to use MySqlConnectionStringBuilder to construct a object I get the error, "Keyword not supported: 'metadata'." Below is a copy of the code. Please advise. (error is in the constructor with the connectString parameter.
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["uwcconceptEntities"];
if (null != settings)
{
string connectString = settings.ConnectionString;
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectString);
builder.Host = "PIE-PC";
builder.Database = "karldbf";
}
Keyword not supported: 'metadata'.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Keyword not supported: 'metadata'.
This error occurs when you pass a connection string with the metadata parameter to the MySqlConnectionStringBuilder constructor. The metadata parameter is not supported in both MySqlConnectionStringBuilder and MySqlConnection. To solve the issue delete the 'metadata=<METADATA>' record from the connection string in your app.config file.WigWugTWW wrote:When I attempt to use MySqlConnectionStringBuilder to construct a object I get the error, "Keyword not supported: 'metadata'."
Re: Keyword not supported: 'metadata'.
The recommendation above was for the using our provider without Entity Framework.
In case you are working with Entity Framework, please try the following code and tell us if this helps:
In case you are working with Entity Framework, please try the following code and tell us if this helps:
Code: Select all
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["TestMEntitiesConnectionString"];
string connectString = settings.ConnectionString;
EntityConnectionStringBuilder entityConnectionStringBuilder = new EntityConnectionStringBuilder(connectString);
MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder(entityConnectionStringBuilder.ProviderConnectionString);
mySqlConnectionStringBuilder.Database = "database";
mySqlConnectionStringBuilder.Host = "host";
entityConnectionStringBuilder.ProviderConnectionString = mySqlConnectionStringBuilder.ToString();
var efConnectionString = entityConnectionStringBuilder.ToString();
TestMEntities context = new TestMEntities(efConnectionString);
....