DDD、NHibernate 和项目结构/命名
对于使用 NHibernate 并尝试引入一些 DDD 概念的 WebForms 解决方案,您建议采用什么合适的项目结构?
假设根命名空间和解决方案名称是 Sample
- Sample.Domain - 包含我的域对象和映射文件
- Sample.Repositories - 包含我的存储库和 nhibernate 连接配置文件
- Sample.Business - 包含我的业务逻辑
- Sample.Web - 实际的 WebForms 项目 -所有演示
我忘记了什么? 有更标准的方式来命名它们吗?
有关于该主题的精彩博客文章吗?
What do you recommend as the proper project structure for a WebForms solution that is utilizing NHibernate and trying to bring in some DDD concepts?
Assuming the root namespace and solution name is Sample
- Sample.Domain - contains my domain objects and my mapping files
- Sample.Repositories - contains my repositories and nhibernate connection config file
- Sample.Business - contains my business logic
- Sample.Web - the actual WebForms project - all Presentation
What am I forgetting? Is there a more standard way to name these?
Any great blog posts on the topic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
缺少的一些部分似乎是整个解决方案和测试项目所需服务的中心位置。 我通常有这样的东西:
我有一个匹配的测试项目树:
当然,根据项目的不同,树会变得更加复杂。 至于讨论,请查看洋葱架构。 您还可以查看 领域驱动设计 上的示例项目,看看您可以从中获得什么。
A few parts missing seem to be a central location for services needed throughout the solution and test projects. I usually have something like this:
I have a matching tree of test projects:
Of course, the tree will get more complex depending on the project. As for discussions, check out the Onion Architecture. You can also check out the sample projects on Domain-Driven Design and see what you can take from those.
我保持简单,并倾向于按名称空间而不是按项目进行隔离,尤其是在开始时。 我通常从解决方案中的三个项目开始:
I keep it simple and lean towards segregating by namespace rather than by project, especially at the beginning. I usually start with three projects in the solution:
我发现每个人都有自己的命名偏好,我更喜欢:
Ben Scheirman 最近还发布了有关此内容的文章:使用解决方案导出 Visual Studio 解决方案工厂。
他使用了不同的结构,但也提供了一种标准化模板的好方法。
I have found everyone has their own preferences for naming, I prefer:
Ben Scheirman also recently posted about this: Exporting Visual Studio Solutions with Solution Factory.
He uses a different structure but also includes a great way to standardize your template.
您可以在s#arp架构中查看它是如何完成的。 它是一个非常坚实的架构框架
You can see how it is done in s#arp architecture. Its a very solid architectural framework