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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:55:19+00:00 2026-06-04T14:55:19+00:00

I am using Entity Framework 4.3.1 and I am trying to insert a new

  • 0

I am using Entity Framework 4.3.1 and I am trying to insert a new record into the table my ProductVersion entity is based on.

The ProductVersion entity has 2 properties that make up a composite primary key for the table called ProductId and ProductOrdinal.

Whenever someone updates a product entry I am creating and passing a ProductVersion entity back to my repository, incrementing the ProductOrdinal property, and attempting to add the entity to the context and save it.

I keep getting the following error:

The property ‘ProductOrdinal’ is part of the object’s key information and cannot be modified.

Neither of the columns that make up the key are autonumbering and I have annotated the properties in my POCO with the following:

[Key, Column("PROD_Ordinal", Order=2), DatabaseGenerated(DatabaseGeneratedOption.None)]
public long ProductOrdinal { get; set; }
  • 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-04T14:55:20+00:00Added an answer on June 4, 2026 at 2:55 pm

    Marc_S was exactly right in his comment as to why this was not working.

    From the exception and your description it seems that you are incrementing the ‘ProductOrdinal’ property on the existing ‘ProductVersion’ instance and trying to save it. What you probably want to do is create a new instance of ‘ProductVersion’ from the existing instance and increment the ‘ProductOrdinal’ property and save the new instance.

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

Sidebar

Related Questions

I need help with trying to insert a record using MVC and Entity Framework.
I'm tring to insert some records into my Sqlite database using the Entity Framework.
I'm trying to insert some data in my database using Entity Framework model, but
I'm trying to make sense of a situation I have using entity framework on
I'm trying out the new scaffolding features in MVC 3, using Entity Framework Code
I am using entity framework to insert details into the database where I have
Using Entity Framework CTP 5 I am trying to make a list of foreign
I am trying to create a generic table editor using Entity Framework. I would
I'm fairly new to entity framework and patterns. How would I insert data into
I was trying to encapsule my application into three layers using entity framework as

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.