这两天一直在看NetTiers,"15分钟"就能够创建好从数据库到biz层的代码,支持C#2.0,自动创建vs2005的solution确实很令人兴奋.
但也发现.net2.0中的datasorce控件,它支持的不是很好,还需要自己的扩展.
例如我如果需要绑定表中的数据到gridview中,我需要用DataRepository.CustomersProvider.GetAll()返回一个范型的datasource,
customerprovider是在DAL层中定义的,getall()是在provider其中定义的抽象方法,然后在dal.sqlClient层中override GetAll()发法,来实现它.
问题是sqlClient中的方法有Trans的参数,而provider中的非抽象方法是没有trans参数的.给Trans复值是在DataRepository中完成的.
所以用obejectdatasource进行绑定的时候会有些麻烦.代码如下
public NorthWind.BusinessLogicLayer.TList<EmployeeTerritories> GetAll()
{
return GetAll(0, int.MaxValue);
}
public abstract NorthWind.BusinessLogicLayer.TList<EmployeeTerritories> GetAll(TransactionManager transactionManager, int start, int pageLength);
我下载了codesmith论坛中的customerDatasource类,但是还不是太会用,看了下demo写的dd也比较多,不知道有什么好的建议.
下面是一些简介
但也发现.net2.0中的datasorce控件,它支持的不是很好,还需要自己的扩展.
例如我如果需要绑定表中的数据到gridview中,我需要用DataRepository.CustomersProvider.GetAll()返回一个范型的datasource,
customerprovider是在DAL层中定义的,getall()是在provider其中定义的抽象方法,然后在dal.sqlClient层中override GetAll()发法,来实现它.
问题是sqlClient中的方法有Trans的参数,而provider中的非抽象方法是没有trans参数的.给Trans复值是在DataRepository中完成的.
所以用obejectdatasource进行绑定的时候会有些麻烦.代码如下
public NorthWind.BusinessLogicLayer.TList<EmployeeTerritories> GetAll()
{
return GetAll(0, int.MaxValue);
}
public abstract NorthWind.BusinessLogicLayer.TList<EmployeeTerritories> GetAll(TransactionManager transactionManager, int start, int pageLength);
我下载了codesmith论坛中的customerDatasource类,但是还不是太会用,看了下demo写的dd也比较多,不知道有什么好的建议.
下面是一些简介
CodeSmith and .NetTiers will:
- Implement Microsoft Patterns and Practices including full Enterprise Library integration
- Generate stored procedures for all CRUD operations including common queries based on indexes and foreign keys with server side paging support
- Generate fully documented feature rich Data Access Layer (DAL) components that support serialization, binding, sorting, paging, and deep loading / saving
- Generate strongly typed collections
- Generate web service APIs for your Data Access Layer components (DAL)
- Generate a full suite of NUnit tests for your Data Access Layer components
- Generate a complete NAnt build script to compile, test and generate CHM/HTML API documentation
- Allow for custom code that will be preserved during re-generation
- Generate Visual Studio Solution and Project Files