I am new to MVC.
I read this short bit detailing three ways to work with the view model in MVC:
http://geekswithblogs.net/michelotti/archive/2009/10/25/asp.net-mvc-view-model-patterns.aspx
The bottom line seems to me that:
Method 1, pull an object from the database and use it as a model for your view. Quick and easy, but if you need data from multiple tables, you are completely screwed up (I can't think of a way around this without method 2).
Method 2, create a class that has references to several objects, and use this as your presentation model. This way you can access everything you need. The article says that when the views become complex, it breaks due to the mismatch of the impedance between the objects of the domain / view model ... I do not understand what this means. The impedance resistance in Google Gogling returned a lot of material, the essence of which was that you represent the database material using objects, and all this is not clean, but you probably ran into this problem even with method 1. Not sure what am I missing. It also seems to me that creating a class for each view to get the required data is not ideal from a service point of view, not sure if you have a choice.
Method 3, I still hug it, but I donβt quite understand why their example flag will not work in method 2 if you added the bool addAdditional class to the class that was not associated with the domain model. Method 3 seems to say rather than return the domain material directly, just pull out the properties you need, which I think is better, but it will be harder to maintain with them, since you will need large constructors that do this.x = domain.x , this.y = domain.y , etc.
I do not understand the builder, namely why the interface is used, but will continue to work on it.
Edit: I just realized that this is not a question, to my question, do I think correctly?