我已经创建了一个项目,我需要在n层应用程序中拆分op (3层)。
我从一个项目开始,加上了我所有的类。fx
public IServiceFoo()
{
DoIt();
}
public ServiceFoo : IServiceFoo
{
...
}添加了IoC和所有这些。开始重构,但撞到了墙上。我有四个大会。
我把我的IServiceFoo接口放在哪里??唯一的逻辑位置是在域/模型程序集中,因为所有其他项目都知道这一点,因此可以使用交叉应用程序。
我是否调用程序集:域安装模型,因为它不再是模型?
服务也是这样吗?这更像是一个基础设施,因为它包含了服务类和计算逻辑。
希望你能帮忙?谢谢。
-编辑- 08142012 --我的解决方案领域:一家商店,用于教育和更好地了解建筑。
Solution (a 3 layers application :D then!)
DAL - assembly (only pulls data up and save data)
- ProductDAL : IProductDal
- GroupDAL : IGroupDAL
- UserDAL : IUserDAL
Service - assembly
- ProductService : IProductService (calculate products, load product by DAL)
- GroupService : IGroupService (do some stuff with group, maybe delete group in list with no product)
- UserService : IUserService (validate if a user can login, load user by dal, check password)
Models - assembly
- Product
- Group
- User
- Webshop - assembly (ASP.NET MVC) (with all the viewmodel and models, UI Helpers)
Using DI/IoC as the glue, that sticks it all to getter.另外:网上商店引用所有程序集。除了接口之外,服务层和dal层知道彼此之间的情况。
我的服务接口和DAL的最佳位置在哪里?希望这能帮上忙
发布于 2012-08-14 04:43:22
分层规则是依赖关系以一种方式进行,而一个层只能连接到另外两个层(上面的层和下面的层)。一旦定义了程序集所处的层,就必须确保它们在项目中的引用方式与该规则相匹配。较低层不能“引用”更高层。如果违反这些规则,则类型不在正确的程序集中。

在这个图中,BL“连接”到另外两个层,上面的层(UI)和下面的层(DA)。箭头显示UI接受对BL的引用,但BL不接受对UI层的引用。与BL和DA一样,BL接受DA的引用,但DA不接受对BL的引用。
https://stackoverflow.com/questions/11945689
复制相似问题