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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:14:55+00:00 2026-06-10T21:14:55+00:00

I have a rather large object with lots of properties. I am using Automapper

  • 0

I have a rather large object with lots of properties.

I am using Automapper to map to the properties from a grid.

Only a few of the properties need to be mapped and the rest have to be ignored as they are used later not at the time of mapping

Is there a way to ‘Ignore’ all of these properties or do I need to write an explicit ‘Ignore’ for every property – see code below. I’d like to be able to ‘.IgnoreAllNotUsed’ instead of having to ignore one by one. Is this possible?

The class inherits from another class but most of the properties are on the actual class itself
link to picture of code
enter image description here

enter image description 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-10T21:14:56+00:00Added an answer on June 10, 2026 at 9:14 pm

    You can use this extension method:

    public static void ForAllUnmappedMembers<TSource, TDestination>(
        this IMappingExpression<TSource, TDestination> mapping, 
        Action<IMemberConfigurationExpression<TSource>> memberOptions)
    {
        var typeMap = Mapper.FindTypeMapFor<TSource, TDestination>();
        foreach(var memberName in typeMap.GetUnmappedPropertyNames())
            mapping.ForMember(memberName, memberOptions);
    }
    

    Use it like this:

    Mapper.CreateMap<Source, Destination>()
          .ForMember(...)
          .ForAllUnmappedMembers(o => o.Ignore());
    

    I haven’t tested it but it should work.

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

Sidebar

Related Questions

In my application I have a rather large object created from some XML files.
I have a rather large project whose Installer is written using NSIS. My problem
I have a rather large application which, on the admin frontend, takes a few
I have a rather large, dynamic sparse matrix object class to write, and I
History: I inherited a rather large app written using MS Access with lots of
I have a rather large ASPX form with lots of textboxes and drop down
I have rather large project that uses ICU regex classes. Basically it might run
I have a rather large text corpus, of which I would like to check
I have a rather large SQL file which starts with the byte order marker
I have a rather large diff of 2 GIT branches and would like to

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.