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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:09:19+00:00 2026-05-11T08:09:19+00:00

Why can’t I define a member with the same name in subclasses? I have

  • 0

Why can’t I define a member with the same name in subclasses? I have a one table per class inheritance with a rowversion timestamp field in each table. It seems like the Entity designer should allow for this and use the new keyword on the property to make it happen. What is the workaround? How can I specify the same field in an inheritance chain with different values if I can’t use new? This may be true for other databases that have rowguids, modifiedbys, modifieddates, etc.

Edit: I guess the logical way to do it would be to just rename the reference to the field, ie PersonRowversion in the Student class that decends from Person.

Am I missing a piece of EF that can track these kinds of fields automatically though?

  • 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. 2026-05-11T08:09:19+00:00Added an answer on May 11, 2026 at 8:09 am

    Because a class cannot have two members with the same name. ‘new’ won’t do what you want. ‘new’ hides the inherited member; it doesn’t give you two different members with the same name. So if the code generated used ‘new’ then you would never be able to access the value in the ‘parent table’ from your C# code. It is fine for both database tables to have two columns of the same name, but you need to rename the duplicate column names in your conceptual model when two tables make up one class.

    In terms of ‘modified date,’ etc., you generally only need one. If you have a super type of Animal and a subtype of Dog, the Entity Framework considers an update to the ‘animal portion’ or the ‘dog portion’ of the type to be an update to the entire instance, just like C# does.

    Remember that the conceptual model and the storage model are different things, and play by different rules. Be careful of thinking in strictly OO or strictly relational terms when working in your entity model. Inside the entity model, you are bridging both worlds. As I wrote elsewhere:

    One of the mental barriers that you have to get over when designing a good object relational mapping is the tendency to think primarily in object oriented terms, or relational terms, whichever suits your personality. A good object relational mapping, though, incorporates both a good object model and a good relational model. For example, let’s say you have a database with a table for People, and related tables for Employees and Customers. A single person might have a record in all three tables. Now, from a strictly relational point of view, you could construct a database VIEW for employees and another one for customers, both of which incorporate information from the People table. When using a one VIEW or the other, you can temporarily think of an individual person as ‘just’ an Employee or ‘just’ a Customer, even though you know that they are both. So someone coming from this worldview might be tempted to do an OO mapping where Employee and Customer are both (direct) subclasses of Person. But this doesn’t work with the data we have; since a single person has both employee and customer records (and since no Person instance can be of the concrete subtype Employee and Customer simultaneously), the OO relationship between Person and Employee needs to be composition rather than inheritance, and similarly for Person and Customer.

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

Sidebar

Ask A Question

Stats

  • Questions 84k
  • Answers 84k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Heres my best attempt so far. It seems to be… May 11, 2026 at 5:03 pm
  • Editorial Team
    Editorial Team added an answer It's pretty simple. The idea is that you have an… May 11, 2026 at 5:03 pm
  • Editorial Team
    Editorial Team added an answer The mshtml control (Internet Explorer engine control) will work. You… May 11, 2026 at 5:03 pm

Related Questions

Why can't you do this and is there are work around? You get this
Why can I not see an option for copying database objects when I right
Why can't I pass the table name to a prepared PDO statement? $stmt =
Why can't I create a class in VB.NET that inherits System.IO.Directory ? According to
Why can't Delphi variants hold objects? More importantly, what's the reason behind this limitation?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.