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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:46:29+00:00 2026-06-03T10:46:29+00:00

Holla, I have an data access object as follows: class Foo : IStorable {

  • 0

Holla,

I have an data access object as follows:

class Foo : IStorable
{
  string name;
  int age;
  .. many more
}

I have another object like this:

class FooViewModel
{ 
  Foo data;
  Bar moreData;
  Car evenMore
}

So i m reading Foo object from database and i have to construct a ViewModel. ViewModel has a Foo object and some other objects as well. I want to map Foo to ViewModel’s Foo.

How can i map this with AutoMapper?

Mapper.CreateMap<Foo, FooViewModel>();

Would this work? and how would I access get it?

Essentially i have classes with many properties, i want to avoid typing (being lazy)

  • 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-03T10:46:32+00:00Added an answer on June 3, 2026 at 10:46 am

    The FooViewModel should have all of the properties of Foo that you would like to map, not a ‘Foo’ property.

    Then, you will be able to use AutoMapper to map Foo to FooViewModel and any relational dependencies that Foo has will not end up in the FooViewModel.

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

Sidebar

Related Questions

Lets say I have string like this: String q = foo (one) bla (two)
Supose I have this string: a= hello world hella warld and I want to
Imagine I have the following data in a table called messages: message_id | language_id
Is there a more complicated example of knockout.js along the lines of Holla https://github.com/maccman/holla/commits/master/app
I have a column in a dataframe like this: npt2$name # [1] Andreas Groll,
I have a buffer with some binary data: var b = new Buffer ([0x00,
I have this HTML: <div> <input type=text class=dropInput> <ul class=inputDrop> <li>Hello</li> <li>Goodbye</li> </ul> <input
I have a table Users, so some rows specially in field Full Name are
I have the following code ... HERE the variable point is a Geopoint object
I have this method public static List<Contact> Load(string filename) { if (!File.Exists(filename)) { throw

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.