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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:40:16+00:00 2026-06-15T21:40:16+00:00

I have removed the PrimaryKey from my table, refreshed the EDMX, and now I

  • 0

I have removed the PrimaryKey from my table, refreshed the EDMX, and now I am getting this error message when doing db.SaveChanges():

Unable to update the EntitySet ‘Results’ because it has a DefiningQuery and no element exists in the element to support the current operation.

Now…
1 – I dont want PrimaryKey in my table. The table is just a bag of values, no PK is required.
2 – I read another post where someone suggested to remove DefiningQuery element from EF generated EDMX. It is not working, and I avoid manual changes to automatically generated EDMX.

Any idea how I can avoid this error, and not define PK in my table?

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-06-15T21:40:17+00:00Added an answer on June 15, 2026 at 9:40 pm

    In Entity Framework everything must have a key, at least in the model. You can remove it from the database but still you’ll have to define a key in the model, which may be a composite key to ensure it is unique. Otherwise EF won’t be able to materialize or save objects correctly.

    However, I would use a primary key in the table anyway. It is no trouble at all to have an identity field in it and you don’t have to worry about finding a unique combination of fields yourself. I can’t imagine that the table does not need some notion of identity, or can it really have two exactly identical rows?

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

Sidebar

Related Questions

There is my site For SEO I have removed the .php extension from all
Since it's integration to the framework, the package seems to have been removed from
I have two entities // All details has been removed @Entity @Table(name = "A_TABLE_NAME")
It didn't have a project and I removed myself as the assignee, now I
I have Visual Studio 2008 and i installed and removed StrataFrame Framework. This framework
Say you have a table schema such as this: friends(friendship_id, uid1, uid2, are_friends) .
I have an sqlite database on android created like this: sqlite> .schema CREATE TABLE
I have a table that looks like this CREATE TABLE IF NOT EXISTS `language`
This is somewhat related to this question : I have a table with a
Changes in database 1- Removed column dimesion from the iC_ProductFeature table 2 - Added

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.