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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:51:52+00:00 2026-06-17T20:51:52+00:00

I have the following classes defined: public class ImageIndexModel { public string Description {get;

  • 0

I have the following classes defined:

public class ImageIndexModel {
   public string Description {get; set;}
   public string InstrumentNumber {get; set;}
}

public class ImageEditModel : ImageIndexModel {
    public int TotalCount = 0;
}

public class Clerk {  //This is actually a class defined by LinqToSql
    public string Description {get; set;}
    public string InstrumentNo {get; set;}
}

Now, in my global.asax, I’ve defined the following Mapping in Application_Start().

Mapper.CreateMap<ImageIndexModel, Clerk>()
   .ForMember(dest => dest.InstrumentNo,
              opt => opt.MapFrom(src => src.InstrumentNumber));

Lastly, in one of my controllers, I have the following code:

var _existing = new Clerk();
var _default = new ImageEditModel() {
                 InstrumentNumber = "12345678", Description = "Test"
               };
Mapper.Map(_default, _existing);

The first time I call the Action on my controller and this mapping is run, everything works fine and the InstrumentNumber is correctly mapped to the InstrumentNo of the Clerk object. However, the second time the Action gets called, InstrumentNo does not get mapped. InstrumentNumber definitely has a value but InstrumentNo remains null.

Any ideas what might be happening here?

  • 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-17T20:51:53+00:00Added an answer on June 17, 2026 at 8:51 pm

    I once had the opposite problem, where too many mappings were happening. It was resolved by calling mapper.reset() as described here for potentially other reasons. Perhaps something else in your application is resetting your mapper out from underneath you such that it is no longer resolving mappings which you believe it should (and does for a short while)? The key from the other question is that Automapper is singleton, and so another portion of your code can load or late-bind and foul it up without you knowing.

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

Sidebar

Related Questions

I have the following simple textbook classes defined: public class Product { public int
I have the following classes defined to do validation: public class DefValidator : IValidate<IDef>
I have the following classes defined: public interface Thingy { ... } public class
Suppose I have two classes defined the following way: public class A { public
I have two classes defined as such: public class Questionnaire { public int QuestionnaireID
I have the following POCO classes: public class Location { public int LocationId {
I have defined an Event class: Event and all the following classes inherit from
Suppose, I have following classes: public class DisposableObj : IDisposable { public ChildObj CreateObj();
I have the following classes. I have a object var of Description class. I
I have the following classes in my Model: public abstract class Entity : IEntity

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.