bobek
bobek

Reputation: 8022

Asp.net mvc 3 model usage with database

I am working on a project that has a large database with all the data already in it. So now, I don't see the mvc project model being used very much, since the views are being strongly typed to a database model.

I am very new to this stuff, so is database simply taking place of the model "space" ?

Upvotes: 1

Views: 155

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

since the views are being strongly typed to a database model

That's wrong. You shouldn't pass any domain models to the views. You should be using view models which are classes specifically designed for the requirements of a given view. A controller action should query your data access layer which will return some domain models and then map those domain models to view models and then pass this view model to the view. A view model is a representation of the database for a specific view.

Upvotes: 2

Related Questions