Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6701343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:55:24+00:00 2026-05-26T06:55:24+00:00

There are a lot of articles about using MVVM patterm for ASP .NET MVC.

  • 0

There are a lot of articles about using MVVM patterm for ASP .NET MVC. For example, it is http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/08/28/asp-net-mvc-and-the-mvvm-pattern.aspx.

There is only one question for me. We have a lot of ViewModels for one Model. How can I fill Model properties automatic by using viewModel object? How to make automatic property mapping?

I use Entity Framework.

For example, I have model Test with the following properties:

  • id
  • name
  • title
  • idUser
  • idCompany

I made ViewModel for my task. This ViewModel (TestUserViewModel) uses for simple user with the following properies:
– id
– name
– title

For example, user edit an existing test. As the result, we have an object with type TestUserViewModel. I want:

  • synchronize Model object and ViewModel.
  • save the default valies for idCompany, idUser – for properties, which were excluded from current ViewModel.
  • use some automatic stuff – it may be something like ApplyCurrentValues. I really don’t want to write a lot of following code:

    modelObj.name=viewModelObj.name;
    modelObj.title=viewModelObj.title;
    

Using System.Reflexion for this looks like bad, too.

So, how to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:55:24+00:00Added an answer on May 26, 2026 at 6:55 am

    If you don’t want to write a lot of mapping code from one object to another you might want to look into mapping tools like AutoMapper http://automapper.org/

    Having said that, as @Darin Dimitrov pointed out, you should review your architecture too. If you are doing ASP.NET MVC you should become more familiar with MVC rather than MVVM. As you read more about how to use MVC you are going to start seeing the use of “viewModels”. Keep in mind that these “viewModels” in MVC have nothing to do with “VM” in “MVVM”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been looking at a lot of post/articles about using Iif(). All of this started
I know there are already a lot of articles about this concept but my
There are a lot of blogs saying that a hasOwnProperty check should be used
There are a lot of questions about didRegisterForRemoteNotificationsWithDeviceToken but they all sidestep a very
There's a lot of questions about bookmarks but none of them answers my question:
I've been reading things here and there for a while now about using an
I have read a lot of articles about whether we should have primary keys
I've read a lot of articles about the UI ,buisness logic ,WCF ,IoC, but
I've been reading a lot about Relational Databases using many JOIN statements on every
There have been a few articles and questions about how to do this but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.