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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:46:57+00:00 2026-06-12T22:46:57+00:00

lets have an DTO class: public class UserDto { public int Id { get;set;

  • 0

lets have an DTO class:

public class UserDto {
  public int Id { get;set; }
}

And viewmodel class (base mvc project library):

public abstract class UserViewModelBase {
  public int Id { get;set; }
}

now when i create mapping for automapper like this:

Mapper.CreateMap<UserDto, UserViewModelBase>();

in main web mvc project i have concreate implementation of UserViewModelBase, like this:

public class UserViewModel: UserViewModelBase {
}

Now when i call this:

Mapper.Map<UserDto, UserViewModel>()

it fails with such error:

Missing type map configuration or unsupported mapping.

UserDto -> UserViewModel

As i understand that this was caused that i havent defined direct mapping between UserDto and UserViewModel.
I want to know if there is some way how to tell AutoMapper that with this map Mapper.CreateMap<UserDto, UserViewModelBase>(); it should accept any type as destination type which inherits from UserViewModelBase.

  • 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-12T22:46:59+00:00Added an answer on June 12, 2026 at 10:46 pm

    Seems no one knows how to achieve this so i made workaround for this.

    My workaround was to build mappings (using Mapper.CreateMap(...)) multiple times each with concreate target class like:

    in ClassLibrary1:

    Mapper.CreateMap<UserDto, UserViewModel1>();
    

    in second ClassLibrary2:

    Mapper.CreateMap<UserDto, UserViewModel2>();
    

    even if UserViewModel1 and UserViewModel2 is derived from same base class UserViewModelBase.

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

Sidebar

Related Questions

Lets have theese objects: public class Obj1 { public string Id { get; set;
Lets say have this immutable record type: public class Record { public Record(int x,
public class DTOa { public int Id { get; set;} public string FirstName {
Lets have a class: public partial class MyControl: UserControl{ private ObservableCollection<string> names = new
I have a standard Domain Layer entity: public class Product { public int Id
Lets I have a utility class called MathUtil. and it looks like this .
Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
Lets suppose I have a RESTful service which has a list of tasks. GET
I have the following domain class: public class Product { public virtual Guid Id
I have a nice resource managing class. For concreteness, lets have it be 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.