how to scaffold complex types in asp.net mvc3?
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 q开发者_运维问答uestion 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!
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/
精彩评论