tags:

views:

126

answers:

6

Can you have an MVC without an ORM?

+1  A: 

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

Darin Dimitrov
+3  A: 

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

Seva Alekseyev
+1  A: 

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.

tau-neutrino
+1  A: 

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

Reed Copsey
A: 

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.

Jörg W Mittag
A: 

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.

A_Var