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 8140769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:16:33+00:00 2026-06-06T12:16:33+00:00

If I have two models that are very different, is it defeating the purpose

  • 0

If I have two models that are very different, is it defeating the purpose to even use a mapping framework such as Auto Mapper or Value Injecter?

For example, say I have two models that are structurally identical, but every property name is different, thus rending all by-convention logic useless. Is it just as well to stick to manually mapping these two models?

I guess I’m mainly trying to understand:

1) Is there any benefit to using a mapping framework aside from the code savings I gain from its by-convention mapping?

2) Is it still easier to set up mapping for the above scenario in a mapping framework vs. manually mapping in this case? (It doesn’t seem like 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-06-06T12:16:34+00:00Added an answer on June 6, 2026 at 12:16 pm

    1) Is there any benefit to using a mapping framework aside from the code savings I gain from its by-convention mapping?

    I think so. It’s one of those one-off kinds of things. Sure, you can write the code to manually DTO from one object to another, maybe about as fast as you can create all of the custom mapping rules. But the very second time you need to DTO, using the mapping framework pays for itself.

    2) Is it still easier to set up mapping for the above scenario in a mapping framework vs. manually mapping in this case? (It doesn’t seem like it.)

    I think it’s about the same:

    Mapper.CreateMap<EntityModel, ViewModel()
        .ForMember(d => d.Prop1, o => o.MapFrom(s => s.Property1))
        .ForMember(d => d.Prop2, o => o.MapFrom(s => s.Property2))
        .ForMember(d => d.Prop3, o => o.MapFrom(s => s.Property3))
            ...
        .ForMember(d => d.PropN, o => o.MapFrom(s => s.PropertyN))
    ;
    

    With this mapping, all of your DTO code will look like this:

    var model = Mapper.Map<ViewModel>(entityInstance);
    

    …versus… If you dit it manually, it looks about the same to me:

    var model = new ViewModel
    {
        Prop1 = entityInstance.Property1,
        Prop2 = entityInstance.Property2,
        Prop3 = entityInstance.Property3,
            ...
        PropN = entityInstance.PropertyN,
    };
    

    Another cool thing about AutoMapper over ValueInjecter is that you only need to define 1 mapping, which will then work for mapping both single instances and collections.

    var models = Mapper.Map<ViewModel[]>(entityInstances);
    

    … versus

    var models = entityInstances.Select(new ViewModel
    {
        Prop1 = entityInstance.Property1,
        Prop2 = entityInstance.Property2,
        Prop3 = entityInstance.Property3,
            ...
        PropN = entityInstance.PropertyN,
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two models User and Admin(with RailsAdmin) that use Devise. I sign in
I have two models that are associated with each other. Customer has_one :primary_contact And
If I have two models that are guaranteed to have a one-to-one correspondence, i.e.
Let's assume I have two gmdistibution models that i obtained using modeldata1=gmdistribution.fit(data1,1); modeldata2=gmdistribution.fit(data2,1); Now
I have two models -- User and Entry -- that are related through a
I have two models (questions and answers) that slightly follow the popular Railscasts :
I have an application that uses Core Data. I have two data models in
I have a form that calls on two separate models. My validation works correctly
Here's my dilemma: I have two types of routes which are semantically very different,
I have a page with two different View Models: <?page title=My page contentType=text/html;charset=UTF-8?> <div

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.