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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:38:04+00:00 2026-05-27T05:38:04+00:00

I have table inheritance in my DB (where descendants reference base with foreign key)

  • 0

I have “table inheritance” in my DB (where descendants reference base with foreign key) and use Linq To Sql as my DAL:

[Table]
class Document {
    [Column]public int ID { get; set; }
    [Column]public int DocTypeID { get; set; }
    [Association]public Application Application { get; set; }
}

[Table]
class Application {
    [Column]public int ID { get; set; }
    [Column]public string AppType { get; set; }
    [Association]public Document Document {get;set}
}

Since L2S does not support multi-table inheritance Application is not inherited from Document. However, in my entity classes i do want inheritance:

class DocumentBase {
    public int ID { get; set; }
    public int DocTypeID { get; set; }
}

class MyApplication : DocumentBase {
    public string AppType { get; set; }
}

Now i’m creating the mappings:

Mapper.CreateMap<Document, DocumentBase>();
Mapper.CreateMap<Application, MyApplication>();

But AutoMapper complains about base properties in MyApplication not mapped. I don’t want to duplicate base properties in MyApplication map (too many descendants from DocumentBase). I found few posts suggesting custom ITypeConverter but don’t understand how to apply it to my scenario. What do i do?

  • 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-05-27T05:38:04+00:00Added an answer on May 27, 2026 at 5:38 am

    Found this solution which also suffers from AssertConfigurationIsValid() complaining about base properties not mapped but slightly modified it:

    static void InheritMappingFromBaseType<S, D>(this IMappingExpression<S, D> mappingExpression)
        where S: Document
        where D: DocumentBase
    {
        mappingExpression // add any other props of Document
            .ForMember(d => d.DocTypeId, opt => opt.MapFrom(s => s.Document.DocTypeId);
    }
    

    Now it can be chained to each DocumentBase descendant map:

    Mapper.CreateMap<Application, MyApplication>()
        .InheritMappingFromBaseType();
    

    and AssertConfigurationIsValid() is happy.

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

Sidebar

Related Questions

I have a situation utilizing class table inheritance where the base object (which is
I have implemented single table inheritance for a person class class Person < ActiveRecord::Base
I have a base class inherited by 2 others via Single Table Inheritance. I
I would like to use form_for except I have class table inheritance models using
I have a card-game application which makes use of Single Table Inheritance. I have
I am using LINQ to SQL with single table inheritance for an audit log.
I have to implemene Single Table Inheritance for a class Person who can be
I am implementing inheritance mapping with D2 using Class Table Inheritance strategy. I have
I want to use partials in rails along with single-table inheritance. I currently have
I'm working on modifying part of an existing Rails app to use the Class-Table-Inheritance

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.