Is this the correct way to implement .NET MVC website structure?
Posted
by
aspdotnetuser
on Programmers
See other posts from Programmers
or by aspdotnetuser
Published on 2012-09-09T19:17:09Z
Indexed on
2012/09/09
21:48 UTC
Read the original article
Hit count: 233
I have recently seen a .NET MVC solution in which the markup in the .aspx
views have a Controller as their model, and the .ascx
user controls they contain use a separate model. I'm new to MVC and I wanted to find out about a few things I'm not clear on.
An example of how the code is implemented:
UserDetails.aspx
view has markup that shows it's using the UserDetailsController.cs
as the model. It contains RenderPartial("User_Details.ascx", UserDetailsModel)
and passes it the UserDetailsModel
.
Is this the standard/correct way of implementing MVC? Or just one way to implement it?
I also noticed that the classes used as Models appear to be Service classes that have [DataMember]
and [DataContract]
attributes on the class name and properties - what is the advantage of this implementation?
© Programmers or respective owner