Driver: Part or ViewModel?

Topics: Writing modules
Sep 3, 2013 at 12:38 PM
Looking at the modules included in the sources of Orchard I have seen that in some cases the driver of a ContentPart uses, as a model, the Part in some cases the ViewModel.
What is the correct way? The Part or the ViewModel?
Coordinator
Sep 3, 2013 at 4:23 PM
You mean in the Edit method, right? Both are correct. You have a choice.
Developer
Sep 4, 2013 at 2:03 AM
Edited Sep 4, 2013 at 2:03 AM
Depends on the scenario actually.
You may want to have an editor form that does not directly map to your content part. In this case using a view model as an intermediate data carrier is what you want.
Sep 4, 2013 at 7:49 AM
Thanks for the replies.
Therefore, there isn't a method "a little 'better" than the other :)
You can choose according to situations

PS: Sorry for my bad English