对于 ASP.NET 中的大型网站,推荐的解决方案结构是什么
我目前正在尝试重构一个根本没有任何分离的项目(asp.net mvc)。只是文件夹 :s
- 该项目有一堆 EF Code First 类(People.cs、Exam.cs、 Message.cs等)
- 该项目有几个存储库(都使用EF Data 上下文)
- 当然还有很多控制器和视图模型
我们有一个测试项目,但我们不太擅长 TDD,所以它不是我们现在真正正在研究的东西。
我希望对项目必须解决的不同职责进行更清晰的划分,并且希望获得一些关于实现这一目标的良好项目结构的建议。
请帮忙。 提前致谢
Im currently trying to refactor a project(asp.net mvc) that doesnt have any separation at all. just folders :s
- The project has a bunch of EF Code First classes (People.cs, Exam.cs,
Message.cs, etc) - The project has several repositories (which all use EF Data
Context) - And of course a lot of controllers and viewmodels
We have a Tests Project but we arent very good at TDD so its not something we are really working on as of now.
I would like to have a clearer separation on the different responsibilities that the project has to address and would appreciate some advice on a good project structure that achieves this.
Please help.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议遵循领域驱动设计 (DDD),一种建议的布局方法是创建以下项目:
Company.Project.Web
<-- 您的 MVC 应用程序,尽管您仍然可以使用网络表单Company.Project.Domain
<-- 数据传输对象 (DTO)、ViewModel、业务逻辑、事件Company.Project.Data
<-- 存储库接口Company.Project.Data.EF
<-- EntityFramework 存储库的具体实现Company.Project.Model
<-- 您的 EF CodeFirst 类Company.Common
<-- 实用程序和/或扩展的常见项目我建议您看一下来自模式和实践团队的 Project Silk http://silk.codeplex.com/。 DDD、Repository 和 MVC 以及 HTML 5 和 jQuery (vNext) 混合的优秀参考实现。
I would suggest following a Domain Driven Design (DDD) and one suggested way of laying this out would be creating the following projects:
Company.Project.Web
<-- Your MVC Application, though you can still use WebFormsCompany.Project.Domain
<-- Data Transfer Objects (DTO's), ViewModels, Business Logic, EventsCompany.Project.Data
<-- Repository InterfacesCompany.Project.Data.EF
<-- EntityFramework Specific Implementation of RepositoriesCompany.Project.Model
<-- Your EF CodeFirst ClassesCompany.Common
<-- A common project of utilities and/or extensionsI would suggest you take a look at Project Silk http://silk.codeplex.com/ from the patterns and practices team. Great reference implementation of DDD, Repository, and MVC as well as mixing in HTML 5 and jQuery (vNext).
我们使用与 jdmonty 提到的类似的设计,但更简单一些。我们执行以下操作:
作用于它们的
项目
Web 项目依赖于 Services 项目。服务项目依赖于域项目。
We use a similar design to that mentioned by jdmonty but a bit simpler. We do the following:
that act on them
projects
The Web project is dependent upon the Services project. The Services project is dependent upon the Domain project.