scaffolding viewmodels based on database tables

纵然是瞬间 提交于 2019-12-11 01:36:59

问题


Is there anything that would aid us in designing/scaffolding View models from SQL Server database tables but would result in very lean classes? I know something like that exists for Rails, maybe there's something similar in ASP.NET MVC?

I like what EF wizard creates but it's too heavy - too much attributes, constraints, events and everything is attached to the entities so you can't actually use them as View models (actually you can but it quickly becomes a pain).


回答1:


I think you could use a POCO generator for your EF4 model instead of the default one. This is a link explaining how. LINK I hope you can adapt it to fill your needs.

A POCO Class(Plain Old CLR Objects) is by definition a lightweight class, that is (maybe) what you're looking for.



来源:https://stackoverflow.com/questions/4771003/scaffolding-viewmodels-based-on-database-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!