Recently I was asked to develop a project. The architecture looks like this:
- Level 1: DataAccess Database on Nhibernate
- 2 levels: a business level based on the WCF service and some basic classes
- Level 3: Silverlight Based Viewing
I am going to use DTO objects to transfer data between the 2nd and 3rd levels.
I realized that the project will have a huge domain model, and many business units must support standard and custom CRUD operations. At the first level, it will be resolved by the NHibernate + Specification common repository.
But Level 2 (one WCF service) will look like a set of methods that provides a custom and standard DTO CRUD interface for Level 3.
For example, the model looks like this:
class Product {}
class Category {}
DTOS:
class ProductDTO {}
class CategoryDTO {}
"problem" WCF service:
public class DataService
{
public List<CategoryDTO> GetAllCategories()
{
}
public List<ProductDTO> GetAllProducts()
{
}
}
:
public class ProductDataService
{
public List<ProductDTO> GetAllProducts()
{
}
}
public class CategoryDataService
{
public List<CategoryDTO> GetAllCategories()
{
}
}
: