webKite
webKite

Reputation: 275

Extracting contents of ConnectionStrings in web.config in Silverlight Business application

I am trying to read dataSource ad Catalog from <connectionStrings> in web.config in Silverlight business project. Unfortunately when I used SqlConnectionStringBuilder, I could not read connection string the has

connectionString="metadata=res://*/MainDatabase.Main.csdl|res://*/MainDatabase.Main.ssdl|......."

where as it work for

connectionString="Data Source=My-PC\SQL_2008;Initial Catalog =....

I could get them using "Split" however, I don't like that solution. Is there any way to get my requirements?

Thanks

Upvotes: 0

Views: 460

Answers (1)

Ben
Ben

Reputation: 6059

Your first connection string (that isn't working) is an Entity Framework connection string - it isn't in a format the SqlConnectionStringBuilder can understand. However, EntityConnectionStringBuilder will understand that, and it has a property called ProviderConnectionString. This property will have the actual SQL connection string in it, which you can pass to a SqlConnectionStringBuilder as in your second example.

Upvotes: 1

Related Questions