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

  • Home
  • SEARCH
  • 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 8895669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:50:34+00:00 2026-06-14T23:50:34+00:00

On a current project we are experimenting with different approaches to populate ViewModel objects

  • 0

On a current project we are experimenting with different approaches to populate ViewModel objects coming from Entity Framework. Currently, upon receiving a list of EntityModel we use an extension method:

public static IEnumerable<ViewModel> GetViewModel(this IEnumberable<EntityModel> data){}

This extension method is defined in the same namespace as the ViewModel objects so as to keep it closely tied to the ViewModel and a specific controller in ASP.NET MVC.

Specifically, we are looking for feedback from the development community on :

  • Is this an appropriate place to be using an extension method. We are concerned because it seems like a break from OOP, and more of a ‘band-aid’ solution.
  • What are ‘Tried and Tested’ ways of populating ViewModel objects from EntityModel objects. We have tried the following:
    • Manually assigning each field in the controller (too much coupling between view and controller)
    • Passing in Entity/ViewModel object into View Model contructor (Best so far, but ViewModel is coupled to Entity)

Thanks in advance for any suggestions/help.

  • 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-06-14T23:50:35+00:00Added an answer on June 14, 2026 at 11:50 pm

    It is advisable to decouple the mapping between EntityModel and ViewModel from either. If the mapping plumbing is coupled to the view, it is difficult to drop in a new view for a different purpose in the future. If tied to the EntityModel, it is difficult to drop in a new entity model, using the same view. Either way, it is more difficult to independently evolve the view model and entity model if the mapping infrastructure is tied to either.

    I would suggest that mapping should be an independent architectural building block, and further suggest you have a look at AutoMapper as an implementation of that component.

    http://automapper.codeplex.com/

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

Sidebar

Related Questions

My current project is in Rails. Coming from a Symfony (PHP) and Django (Python)
for my current project i need to consume messages from many destinations (from hundreds
For my current project I have to send a signature from PHP to Java
my current project is based on Entity Framwork code-first. I have three types: Task,
My current project is to take information from an OleDbDatabase and .CSV files and
I'm studying TDD and experimenting it in my current project. I've noticed that I
In a current project, I'm experimenting around a lot to see the performance influence
My current project is a form that receives input from a user. After I
I am experimenting with integrating RestKit into my current project. I am retrieving data
My current project is broken down into 3 parts: Website, Desktop Client, and a

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.