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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:49:20+00:00 2026-05-28T16:49:20+00:00

I have a simple entity data model where I have two entities and a

  • 0

I have a simple entity data model where I have two entities and a 1-* relation between them. For simplification purposes let’s say Person and Book. (i.e. people have 0 or more books and books must have an owner)

The system works fine and it has data in it.

Now I need to create other entities inherited from Person (i.e. Student, Teacher)

When I create them and update my software accordingly, everything works fine with this new model.

Now I need to migrate the old data (data in Person which is linked to books)
In my data I know which person’s are student and which are Teacher and I have additional information on the Students and Teachers that I’ll place in the new model.

The question is how do I migrate the data. I cannot add Students and Teachers before I delete the Person instance because that would create duplicate Id in Person. I cannot delete the Person as it creates an error. (“DELETE statement conflicted with REFERENCE constraint”)

How do I acheive this data migration.

Thanks

  • 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-28T16:49:20+00:00Added an answer on May 28, 2026 at 4:49 pm

    If you really have mapped inheritance you should not delete Person – the Person is either Student or Teacher so you should just add correct columns (in case of TPH) or related tables (in case of TPT) and use existing data without their modification.

    This migration must be done in SQL.

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

Sidebar

Related Questions

I'm using core data and I have a simple two-entity model. My navigation controller
I have a pretty simple console project with an entity model (containing two simple
We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it
I'm trying to add an object created from Entity Data Model classes. I have
We have a simple Table per Type Entity Framework 4.0 model :- ALl classes
I am using the new ADO.NET Entity Data Model on a simple database. I
I'm using the Entity Framework to model a simple parent child relationship between a
For example I have data model like this Entity: Store Entity: Inventory Entity:Product Attribute:
I have a problem. Imagine this data model: [Person] table has: PersonId, Name1 [Tag]
I have a simple data model and I am using EF4.1 code first (but

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.