Sql – Multiple class libraries in business layer, or one


My ASP.NET application uses only 1 SQL Server 2000 database and no more than 50 tables in it. And I copied an instance of the database to run on my develop PC, so I need to switch the connections between dev and release.

The problem is, I had created multiple class libraries in my business layer, and each class library has a LINQ to SQL class. Now I find it difficult to make all of the DBML files in the different projects use the same connection string.

So is my design wrong? Should I only use 1 class library? If I continue to use multiple class libraries, how do I ensure the same connection string is used in all libraries in release mode?

Best Solution

Put your DBML in its own class library (assembly), and reference it in your other class libraries. That way, you can make your changes to the DBML in one place.

If you have partial classes that implement business logic, I would go ahead and put those in your other class libraries.

Related Question