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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:42:49+00:00 2026-05-26T18:42:49+00:00

Application uses Entity Framework 4.1 with database first approach. I have in database a

  • 0

Application uses Entity Framework 4.1 with database first approach.

I have in database a simple table for logging purposes:

CREATE TABLE [dbo].[LogEntrys](
    [LogEntryID] [bigint] IDENTITY(1,1) NOT NULL,
    [Timestamp] [datetime] NULL,
    [Message] [varchar](5000) NULL,
    [IP] [varchar](50) NULL,
    [UserName] [varchar](256) NULL,
    [Controller] [varchar](50) NULL,
    [Action] [varchar](50) NULL
)

It translates ok in model into EntitySet ‘LogEntrys’ and Entity LogEntry.
Problem is, when i try to insert something into the table from applicatio i get the following error:

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

I have seen similar posts on SO and i have tried to solve it by editing the XML edmx file like explained in this tip: MSDN blog tip 34, I have removed the Defining query. The key was already set up as it should be.

but then i get the following error:

“Invalid object name ‘AMSModelStoreContainer.LogEntrys’.”

I am not sure what is the problem, and/or what i am doing wrong?

any ideas?

Thank you.

  • 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-26T18:42:50+00:00Added an answer on May 26, 2026 at 6:42 pm

    The problem is that the no field is set as primary key create your table like this

    CREATE TABLE [dbo].[LogEntrys](
        [LogEntryID] [bigint] IDENTITY(1,1) NOT NULL,
        [Timestamp] [datetime] NULL,
        [Message] [varchar](5000) NULL,
        [IP] [varchar](50) NULL,
        [UserName] [varchar](256) NULL,
        [Controller] [varchar](50) NULL,
        [Action] [varchar](50) NULL,
     CONSTRAINT [PK_LogEntrys] PRIMARY KEY CLUSTERED 
    (
        [LogEntryID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    

    and then update your model. You might need to completely remove the old one entry you had for it in your .edmx and re=add it now that you have tinkered with it.

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

Sidebar

Related Questions

I have c# application which writes files to an sqlite database. It uses entity
I have an ASP.NET MVC 3 (using Entity Framework 4.2) application that uses transactions
I have built an ASP.NET MVC web application that uses Entity Framework. To provide
I currently have a project that uses Entity Framework 4.1 for logging to a
I have a large application that uses EJB 2.x entity beans (BMP). This is
I have been using Entity Framework CTP with Code-First as in this tutorial by
I have a WCF service that uses the entity framework to retrieve records from
My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following
I'm using Code-first and entity framework in my .NET MVC 3 application, I created
My WPF desktop-based application uses ADO.Net Entity Framework in order to connect to SQL

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.