0

To get the connection string from my App.config I write this code:

ConnectionStringSettings settings
    = ConfigurationManager.ConnectionStrings["livresEntities"];

string connectString = settings.ConnectionString;

Console.WriteLine("Original: "+ connectString);

The result (I use Data Model .edmx file):

Original: metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;persistsecurityinfo=True;database=livres"

But when I want to change the password or the uid using this line:

MySqlConnectionStringBuilder builder
    = new MySqlConnectionStringBuilder(connectString);<br>

It give me the following error:

Keyword not supported

Why? If there is any tutorial on how to secure MySQL's connection string using a Model (.edmx) it will be very helpful for me.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
  • That doesn't look like a valid connection string to me. It appears to be some sort of Entity Framework configuration that has a connection string inside. – Mike Christensen Jun 20 '14 at 18:02
  • I think that too but I don't know the difference between connection string of EF and MySql, anyway how can I modify the password using this EF's connectionString – user3757742 Jun 20 '14 at 18:04
  • Yea I don't know EF that well. I'm wondering if there's an API that can parse that configuration and extract the connection string. Hopefully someone with some EF expertise will chime in. – Mike Christensen Jun 20 '14 at 18:07

0 Answers0