ASP.NET MVC - 解决方案布局的建议 [英] ASP.NET MVC - Solution Layout Suggestions

查看:98
本文介绍了ASP.NET MVC - 解决方案布局的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在工作与ASP.NET MVC的几个月,我还是不满意我的项目的解决方案的布局。我试图构建一个中型网站的CMS是便携和可重复使用的可能和有在它的设计中的一些明显的问题。我找的关于我应该怎么构建我的解决方案考虑分离关注的一些建议。我发现这里 href=\"http://stackoverflow.com/questions/832497/asp-net-mvc-solution-organization\">过类似的问题,但它并没有真正针对一些这些问题,我面对的问题。

I have been working with ASP.NET MVC for a couple of months now and I'm still not happy with the layout of my project's solution. I am trying to construct a mid-sized website CMS that is as portable and reusable as possible and there are some obvious problems in the design of it. I am looking for some advice regarding how I should structure my solution in consideration of separation of concerns. I've found a similar question here, but it doesn't really target some of the issues I am facing.

现在这是我的解决方案是如何布局:

Right now this is how my solution is laid out:


+Project.Controllers - All Controller classes
P+roject.Controllers.Tests

+Project.Core - Utility classes including repetitive tasks and some configuration handlers (this project needs to be better fleshed out)
+Project.Core.Tests

+Project.Models - Model classes, Entity Framework context, and Repository classes
+Project.Models.Tests

+Project.Web - All Views and Content

我目前缺少一个重要的事情是要坚持我的业务逻辑的地方,我觉得我已经被错误地把业务逻辑在我的仓库类以及在控制器动作交织它。很显然,我很清楚这个问题,我只是不知道在那里我应该把我的业务逻辑在该解决方案的布局。我的解决方案结构需要改变,我也可以放心地保持业务逻辑在我的模型的项目?另外,我真的不喜欢我的EF上下文是在模型类,但我不知道的方式,从在我的模型所需要的实体类隔离数据层code。

One major thing I am currently missing is a place to stick my business logic and I feel I've been wrongly placing business logic in my repository classes as well as intermingling it in controller actions. Obviously, I'm very aware of this problem, I'm just not sure where I should placing my business logic in that solution layout. Does my solution structure need to change or can I safely keep that business logic in my Models project? Also, I really don't like that my EF Context is in the Models class, but I don't know of a way to isolate the data layer code from the Entity Classes needed in my model.

如何每个人都奠定了其生产的ASP.NET MVC的解决方案?

How is everyone else laying out their production ASP.NET MVC solutions?

推荐答案

您可能要检查出布局的取值#ARP架构使用项目或的洋葱架构 code阵营服务器<使用/ A> MVC参考应用。这两个项目都配发了努力由不同的人投入他们获得关注的好sepperation在asp.net MVC和领域驱动设计的情况下。

You might want to check out the layout the S#arp architecture project uses or the onion architecture as used in the Code Camp Server MVC reference application. Both projects have had allot of effort put into them by different people to get a good sepperation of concerns in the context of asp.net MVC and domain driven design.

这篇关于ASP.NET MVC - 解决方案布局的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆