how to scaffold complex types in asp.net mvc3?

淺唱寂寞╮ 提交于 2019-12-23 03:23:30

问题


I have a User class that has a property of type Login, which is just another simple class composed of two string properties, Username and Password.

What would be the correct (and best) way to make MVC3 scaffold the Login property too when adding a Scaffolded View for the User class?

I saw this question related to this right here on StackOverflow, but it asked MVC2, and since I've read that MVC3 improved scaffolding a lot, I want to know if there's a better way to do it.

Thanks!


回答1:


EDIT: This article shows how to do what you're looking for exactly (one to many relationship):

http://weblogs.asp.net/scottgu/archive/2011/05/05/ef-code-first-and-data-scaffolding-with-the-asp-net-mvc-3-tools-update.aspx

Steven Sanderson is also crazy good with this kind of stuff. Check out his MvcScaffolding project with a One to Many relationship scaffolder:

http://blog.stevensanderson.com/2011/01/28/mvcscaffolding-one-to-many-relationships/



来源:https://stackoverflow.com/questions/5864939/how-to-scaffold-complex-types-in-asp-net-mvc3

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