开发者

Can you have MVC without an ORM? [closed]

开发者 https://www.devze.com 2023-01-17 05:02 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form开发者_如何学运维
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form开发者_如何学运维. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Can you have an MVC without an ORM?


Yes. MVC and ORM are answers to different, marginally related common problems - interaction with GUI and database access. Also, MVC is way older.


Sure. In my day job we use Spring-MVC and handle all persistence manually through templates. We feel it gives us more control.

Most (all?) MVC frameworks should allow you to either plug in your own DB access coded against an interface (if this concept exists in whatever implementation language you are using) or just hand code it right in there.


MVC itself means clear separation of the presentation, controller and model layers. So what way you select to implement each individual layer is completely upto you. You can implement the model layer without ORM's as well. You can just open a normal sql connection and use normal ADO.Net classes (remember dataview and dataadapter classes??) to get the data. If you think you have good database skills and need more control on sql queries go with the old methods. ORM's are for making the life of web developers better since they are not expected to have excellent database skills. The added bonus ofcourse is the ability to deal with database in an object oriented way and some layer of persistence.


Of course you can. Those are two completely different things that can be used together as well.


The data access is all underlying the Model in MVC - whether you use an ORM or any other technology for the data layer.


Of course you can. Those two things have absolutely nothing to do with each other. They are in no way related to each other. Not even remotely. They live in completely different worlds.

They live in different areas of the application: MVC is about user interaction, ORM is about database access.

They live on different abstraction levels: MVC is an architecture pattern, ORM is a type of library.

This is of course most obvious when you consider that ORMs didn't exist in 1977.

0

精彩评论

暂无评论...
验证码 换一张
取 消