mvc4中的3层体系结构 [英] 3 Tier architecture in mvc4

查看:98
本文介绍了mvc4中的3层体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在学习使用3层架构的mvc4。我正在使用visual studio 2012和sql server 2012创建一个简单的应用程序。

我在这个项目中创建了一个项目添加我添加了另外两个项目,分别是DAL(数据访问层)和BLL(业务逻辑层)。

现在我很困惑我应该在哪个部分编写哪些代码。

我应该在哪里使用模型类,控制器,特别是我应该在BLL中编写什么代码。



Plz告诉我该怎么做。

谢谢

解决方案

表示层是你的MVC项目。 MVC包含模型和视图模型,这可能会使这种事情变得混乱。理论上,您的业务层处理所有业务逻辑,数据库处理从数据库获取数据并将其存储在那里。



我不知道我有多远虽然我会寻求编写一个数据层,但我认为业务规则很难分解,除非你的模型也来自你的业务层(他们当然可以做)

Hi,
I am learning mvc4 using 3 tier architecture . I am creating a simple application with visual studio 2012 and sql server 2012.
I have created a project add in this project i have added two more project which are DAL (data access layer) & BLL (business logic layer).
now i am confused which code should I write in which part.
where should i use model class, controllers and specially what code should i write in BLL.

Plz tell me what to do.
Thankyou

解决方案

The presentation layer is your MVC project. MVC includes models and viewmodels, which can make this sort of thing confused. In theory, your business layer handles all the business logic, and the database handles getting data from the DB and storing it there.

I'm not sure how far I'd go with n tiered in MVC, although I would seek to write a data layer, I think the business rules will be hard to factor out, unless your models also come from your business layer ( which they can do, of course )


这篇关于mvc4中的3层体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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