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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:37:08+00:00 2026-06-12T11:37:08+00:00

I have entity like below public abstract class MyBaseClass { public int Id {

  • 0

I have entity like below

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

public class MyConcrete : MyBaseClass
{
    public int TemplateName { get; set; }
    public int Total { get; set; }
}

public class MyOtherConcrete : MyBaseClass
{
    public int TemplateName { get; set; }
    public int MyProperty { get; set; }
    public string OtherProperty { get; set; }
}

using default initialization, EF will make table with columns like bellow:

Id
TemplateName
TemplateName1 // <-- this is the problem
Total
MyPorperty
MyOtherProperty

now my question how to configure EF so all the TemplateName property on derived class automatically mapped into TemplateName column without making another column. is it possible to configure it on OnModelCreating method?

EDIT

actually above was simplified version of my problem. i have 10 more entities some property might duplicated everywhere and i don’t want to add any abstraction layers.

i have tried manually map the column on the OnModelCreating but having “Each property name in a type must be unique. Property name ‘TemplateName’ was already defined” exception any idea?

EDIT 2

so, i found here, that said it is impossible to do such thing like above in EF, it is weird for me..

  • 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-12T11:37:10+00:00Added an answer on June 12, 2026 at 11:37 am

    After searching through the net, so far that was not possible to do that. since i realize that my inheritance tree is wrong.

    so in my case, i should change my code to match the EF requirement, it is sound weird.. because in many case ENTITY is a NO NO to change, we usually create an entity that used in multiple project. event we found our entity wrong we won’t update it because updating it will require massive change on the other projects.

    so far, i think there is no exact answer for my question. will update it soon after EF support it.

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

Sidebar

Related Questions

I have a model called 'UserRoleHolder' like below. @Entity public class UserRoleHolder extends Model
I have a Customer class defined like this: @Entity public class Customer { //...
I have a Person and an Organisation Entity: Person looks like this: public class
I have a class as below: public class Node { public int NodeID {
I have two observalbe collections like below public ObservableCollection<Employee> AllEmployees { get { return
Suppose I have a resource like below: namespace OpenRastaApp.Resources { public class Foo {
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I have a JPA object which has a many-to-many relationship like this: @Entity public
I have a variable declared like this in a class: Entity *array[BOARD_SIZE][BOARD_SIZE]; I need
Let's say there is a entity class like this @Entity public class User {

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.