开发者

Generating view with scaffolding for ASP.NET MVC3

开发者 https://www.devze.com 2023-03-20 02:34 出处:网络
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'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 controlle开发者_如何学编程r like scaffolding do for ASP.NET MVC without involving model highly like MVC do ?

Thanks


You can go through the MVC Scaffolding articles. Basically what you have to do is edit the default templates and power shell scripts.


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

0

精彩评论

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