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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:18:02+00:00 2026-06-04T22:18:02+00:00

I am using Oracle with Entity Framework. The database ids are generated using triggers

  • 0

I am using Oracle with Entity Framework. The database ids are generated using triggers and sequences.

I want to set up Table-per-Type inheritance, as described here. I’ve set the “CourseId” to be StoreGeneratedPattern of “Identity”.

Everything seems to be fine, except when I insert a row. The table representing the base class (in the walkthrough linked above, the Course table) gets a generated ID as expected.

However the table representing the inherited class (in the walkthrough linked above, the OnlineCourse table) has a row inserted with the CourseId set to zero. This violates the foreign key constraint.

I assume it’s something to do with the sequence of inserts. I imagine it should work like:

  • Insert the Course row
  • Retrieve the newly created CourseId value
  • Insert the OnlineCourse, using the new CourseId

However, this isn’t working because it’s just using the default value of the CourseId (zero) to insert into OnlineCourse.

Any ideas how to fix this?

  • 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-04T22:18:04+00:00Added an answer on June 4, 2026 at 10:18 pm

    Since @Campinho hasn’t written up his suggestion as an answer, I will do it.

    This article has some background on a bug in StoreGeneratedPattern in VS2010.

    One of very important features in ORM tools is an ability to get data auto-generated by a database during the entity persistence back to your application. The Entity framework supports this feature by setting StoreGeneratedPattern in the configuration of persisted property. The StoreGeneratedPattern setting is available in both SSDL (Store schema definition language) and CSDL (Conceptual schema definition language) parts of the EDMX file. CSDL configuration allows you defining the reloading behavior in the Model-first approach but SSDL part is responsible for generating correct SQL commands which will persist the entity and reload auto-generated properties. Unfortunately for a long time this was the source of all problems.

    The feature was very hard to use because of the annoying bug in the Entity designer. When we set the property in the designer, the value was saved only in CSDL part but not in SSDL part of the EDMX file and the feature didn’t work until we opened the EDMX file as XML and manually modified SSDL part. This solved the problem but only until we updated our model from the database. The update always deleted whole SSDL part including our manual change so we had to do it again. Any incremental development of our models become a big pain. The workaround was using mapped stored procedures for inserting and updating entities and mapping result sets (returning auto-generated data) from these stored procedures back to the entity. Finally this bug is solved in Visual Studio 2010 SP1 and we can use StoreGeneratedPattern without any problems because the value is correctly set in both CSDL and SSDL parts and it is not overwritten during updating from the database.

    If you have this problem install KB2561001.

    I installed the hotfix and changed the StoreGeneratedPattern to "None" then back to "Identity" for the relevant Ids. I could clearly see the SSDL section had been updated to indicate the new setting.

    Then everything just worked! I’m not sure what’s going to be in the patch from Oracle that they think will fix the problem.

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

Sidebar

Related Questions

I'm thinking about using Entity Framework in an ASP.NET application, using an Oracle database.
In my project I am using oracle and entity framework together.Both of my machines
Im using Devart dotConnect for Oracle - Entity Framework + .NET 3.5. When i
Using Silverlight 4, Oracle 11g, and Entity Framework 4. I use a DataServiceQuery to
I'm trying to access my Oracle XE database using Visual C# Express and entity
I'm using Oracle provider for Entity framework (beta), and I'm facing a problem. Our
I am using attempting to create a connection to an Oracle database via entity
Using Entity Framework and Oracle DB, I would like to insert into tablename (datetimefield,
Using oracle database. Here's how i think the SQLException happens... Say i have two
I am investigating the use of Entity Framework in my organization. We use Oracle

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.