LINQ to sQL:业务层多个Class Library,or 只用一个?
在公司内部某系统的开发过程中,为了让公司里另外一个业余编程人员参与开发,在设计的时候特意考虑降低代码结构的复杂度。在实现业务层的时候,我告诉他对每一个单独的业务单元创建一个新的Class Library,在每个Class Library中建立自己的LINQ to SQL class(DBML)。
现在发现这样的结构有一个问题,就是很难统一每个DBML文件所使用的的ConnectionString。因为都是单独设定的。虽然在网上包括MSDN、StackOverflow上看到了一些相关的问题,例如“Multiple LINQ to SQL Classes or one”?但是这些问题的前提都是多个DBML存在于一个Class Library中。
我们的系统其实并不复杂,只使用了一个数据库,表格数目不超过100个。
那么究竟是使用多个Class Library,还是一个呢?
I went to msdn and asked the question:
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 business layer, each class library has a LINQ to SQL class. now I find it difficult to make all dbml files in different projects use the same connection string. so is my design wrong? Should i only use 1 class library? then if remain to use multiple class libraries, how to ensure the same connectionstring is used when release?
其实这个问题还是“业务层怎么实现”的问题。也就是说,我是不是考虑的太狭隘了,将原本不需要划分成多个class library Peoject的东西“琐碎”化了?
现在发现这样的结构有一个问题,就是很难统一每个DBML文件所使用的的ConnectionString。因为都是单独设定的。虽然在网上包括MSDN、StackOverflow上看到了一些相关的问题,例如“Multiple LINQ to SQL Classes or one”?但是这些问题的前提都是多个DBML存在于一个Class Library中。
我们的系统其实并不复杂,只使用了一个数据库,表格数目不超过100个。
那么究竟是使用多个Class Library,还是一个呢?
I went to msdn and asked the question:
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 business layer, each class library has a LINQ to SQL class. now I find it difficult to make all dbml files in different projects use the same connection string. so is my design wrong? Should i only use 1 class library? then if remain to use multiple class libraries, how to ensure the same connectionstring is used when release?
其实这个问题还是“业务层怎么实现”的问题。也就是说,我是不是考虑的太狭隘了,将原本不需要划分成多个class library Peoject的东西“琐碎”化了?
...全文
相关推荐
LINQ to SQL 创建三层建构
- **表示层**:调用业务逻辑层提供的服务,实现与用户的交互。##### 3.3 组织代码的最佳实践为了更好地管理和维护代码,建议将不同的层分别放在不同的类库(Class Library)项目中。
Visual C# 2012 How to Program 5th Edition
数据库访问:学习使用***和LINQ to SQL进行数据库编程,包括SQL语言基础。为了方便读者学习和实践,该书可能还包含了示例代码、练习题、案例研究和编程挑战等内容。
McGraw.Hill.Osborne.Media.C.Sharp.3.0.A.Beginners.Guide.Aug.2008.eBook-DDU.pdf
#### .NET Framework Class Library除了C#语言本身,本书还提到了.NET Framework Class Library(简称BCL),这是一个包含大量预定义类和接口的集合
DotNET面试题
它包含在多个命名空间中,如System、System.IO、System.Net等。4. **简述.NET中的三层架构?**.NET三层架构通常指的是表示层、业务逻辑层和数据访问层。
带有答案的面试题,包括c#,SQL
. **.NET框架**:了解.NET Framework,包括CLR(Common Language Runtime)和BCL(Base Class Library),是理解C#运行环境的关键。


分析与设计
