When you work with LINQ to SQL you probably want your DataContext (and all the entities) to be in its own assembly. It’s a normal decision when developing n-tier applications.
The Problem
When you create your LINQ to SQL classes file (dbml) you have two options for your database connection string:
- In Settings.settngs file of the corresponding assembly
- Hard-coded in your DataContext desginer (.designer.cs file)
Well, when you have a web application or WinForms/WPF application you definitely would like to manage your connection string from the general config file (web.config or app.config). In this situation it would be a little pain. Continue Reading…