Domain Model To Viewmodel
You can make them look completely different and customize the mapping in your createmap call.
Domain model to viewmodel. You do not need a 1 1 mapping between domain entity and viewmodel. So to conclude unlike domain model view and edit models are entities specifically used in the context of user interface also these are not some fixed technical terms which are set in stone some people call edit models as post model consider you have some kind of reports where you want to have employee details shown you may want to call it report model lastly there will be cases where you may want to use your domain model it self for viewing or editing its possible especially in small. My view model will only contain first name and last name.
I think i will just go ahead and make a viewmodel project in ui level folder and separate mapping from viewmodel itself. A domain model represents the object that represents the data in the database. The viewmodel may expose the model directly or properties related to the model for data binding.
They are retrieved from the database or persisted to the database by the data access layer. I made a simple mock yesterday and put mapping to the viewmodel itself it works but as you say it not really srp friendly. The model is an object using that we can pass the information data to the database.
Generally you do not want to expose domain entities to your view in mvc this would be exposing your model directly to your view which is incorrect. You might have heard discussion about view first or viewmodel first. The viewmodel can contain interfaces to services configuration data etc in order to fetch and manipulate the properties it exposes to the view.
The domain model usually has one to one relationship with the tables in the database. Domain model represents a domain object in our application like a entity framwork sql while using orm. What is model domain model.
The chicken or the egg. Var login new login username viewmodel username password viewmodel password. When i want to convert my domain model to my view model for display i pass the domain model into the view model constructor to handle the mapping and then i pass the view model to the view.