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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:14:13+00:00 2026-06-03T07:14:13+00:00

We are using the v4 Entity Framework as part of a new version of

  • 0

We are using the v4 Entity Framework as part of a new version of an application that includes some significant accounting functions (payment processing, cash balancing, bad check handling, etc.) In all of our previous applications, we have instituted a policy (which I’m told is extremely common in banking/accounting level applications) that there is at least one table, containing the incoming “audit trail” for all money, that can only be written to with new data.

In other words, new information coming in to the system would trigger the creation of a new entity, which would go through the “insert” operation of whatever data layer objects we had and write a new row into the underlying tables. The data layer was intentionally implemented with no update or delete actions for these entities; any changes were tracked as newly inserted adjusting rows.

With EF, we are looking for a way to accomplish the same goal, but in this case, we obviously need to prevent the EF from allowing the updates (as opposed to just not writing the functions). Is there some way to designate an entity in an EF model as being “insert only”?

As I mentioned in the title: I know this can be accomplished by mapping stored procedures to the Insert action but not the Update action. We are looking for some other option, if one exists, for two reasons:

  1. We don’t have any stored procedures as yet, and would like to avoid adding another element to our deployment/upgrade process if we can avoid it.
  2. This solution relies on the “absence” of a stored procedure to indicate that the table is special. I’d prefer a solution that relied on a definitive assertion that the “insert-only” is that way on purpose.
  • 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-03T07:14:15+00:00Added an answer on June 3, 2026 at 7:14 am

    Yup your best bet is to add .AsNoTracking into the getters for each DbSet in your model. This will mean that EF wont be tracking any entities you get from the database (so wont perform any write backs on them). It also has the added bonus of improving performance.

    By forcing all reads to be read only you will eliminate the update path in EF.

    Take a look at my post on AsNoTracking, and this article on the EF site

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

Sidebar

Related Questions

I'm using Entity Framework in my project, and I have the problem that, once
I am using Entity Framework 4 in a desktop application with SQL Compact. I
We are using Entity Framework 1.0. In some cases we need to explicitly open
I am inserting a new row to the database table using Entity Framework, but
I have an app that is saving to a db (using Entity Framework) and
I am using Entity Framework 4.3.1 and I am trying to insert a new
I'm in the midst of rewriting a database application and using Entity Framework to
I'm using Entity Framework and MVC3, and my problem is that I can't scaffold
Using Entity Framework, I suddenly get this strange error after publishing my asp.net mvc
(USING ENTITY FRAMEWORK 4.3 CODE FIRST) The code is below. I want to actually

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.