Search code examples
asp.net-mvcasp.net-mvc-3scaffolding

Generating view with scaffolding for ASP.NET MVC3


I'm doing a project with ASP.NET MVC3 and Linq to Entity . I have separated my data access layer through a different project and of course its not highly coupled with Model.

I have seen the scaffolding ( auto code generation for controller and corresponding views) feature which depends on Model.

Is there any tools or specific procedure through which I will be able to generate views for a specific controller like scaffolding do for ASP.NET MVC without involving model highly like MVC do ?

Thanks


Solution

  • The model that you are talking about here doesn't have to be a Database generated class. It can be anything, so what I would do is create a ViewModel (class) that will represent that view you want to display and use the Scaffolding functionality on that ViewModel.

    You can then use something like an Automapper to bind your models to the view models