c# - Map ViewModel / partials with AutoMapper -


I have created the presentation model and I want to map it to the view modal (with Automap). ViewModel is composite / because I'm using partial and I want to reuse the keyboard view model on other views / partials as well.

How can I see this presentation model in Maple? Is this the right way?

Thank you!

  Public Segment Main Presentation Model: Bee Performance Model {// Main view should be done in model. Keyboard Keyboard {private; Set; } // should be located in main wichdom model. Keyboard Default Keioban Public ILIT & lt; Keyboard & gt; Keyboard {Receive; Set; } // should be the map in the Main View Model. Get some public string {some; Set; }} Public Class MainWorld MODEL: BaseViewModel {Public KeyboardSwim Model Keyboard {Get; Set; } Some of the public string {receives; Set; }} Public Square KeyboardSwimmedale {PUBLIC Inc. DEFAULTKEYBOARD {Received; Set; } Public IList & lt; Keyboard & gt; Keyboard {Receive; Set; EDIT: After trying, I think this is an option:  
  Mapper Createmap & lt; Main Presentation Model, Main View Circle & gt; () .mail member (d) = & gt; D.Keyboard, OPT = & gt; Opt.MapFrom (src = & gt; src)); Mapper Createmap & lt; Main Presentation Model, Keyboard View Module & gt; ();  

It seems that it works, but I'm not sure it's the optimal / correct way ...

This definitely works like you can also use the interface for these composite UIs. For example, partial can accept an IKeyboardsViewModel, and then you will not need to worry about complex heritage hierarchies. You can then slice each partial main model.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -