Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
When modifying Linq to  Sql data model in Visual Studio 2010,  it re-assigns ConnectionString that is available on developer’s machine.
Because the name can be different on different machines, Designer often replace it with something like ConnectionString1, which causes errors during deployment.
It requires developers to ensure that ConnectionString stays unchanged.
 
More reliable way is to use context constructor with explicit ConnectionString name instead of parameterless default constructor

GOOD:
  var ctx = new MyModelDataContext(Settings.Default.ConnectionString);
Not good:
         var ctx = new MyModelDataContext(); Posted on Saturday, April 14, 2012 1:44 PM Visual Studio/TFS/git , LINQ | Back to top


Comments on this post: Specify Linq To SQL ConnectionString explicitly

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net