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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:56:07+00:00 2026-05-24T10:56:07+00:00

I am using EF v1 and Velocity cache in my .NET 3.5 application. My

  • 0

I am using EF v1 and Velocity cache in my .NET 3.5 application. My cached objects are a representation of the Entity model in database. So I decided to use EF v1 with POCO adapters. So there’s an entity access layer that reads the object from cache and if not present reads it from database and caches it immediately. Now in the use case where a update is required, the dirty POCO needs to be updated in database. Now I cant directly use the POCO adapters and proxies here since they need a backing objects that are tracking changes. I never hydrated the adapter object from the framework so change detection is not happening. The easiest option I see is to:

  1. Read the entity before update. Set the adapter values from POCO. Let change detection take its course. This does a select before every update which could be costly given many associated entities.
  2. Create a new Entity object. Set the Entity key and properties from POCO. Save Changes. This does unnecessary writes even when property/associated entity has not been changed.

I hope I was clear in the problem statement. Please suggest.

  • 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-24T10:56:08+00:00Added an answer on May 24, 2026 at 10:56 am

    Actually turns out 1. and 2. are the same. You need to do a read of the entity entirely (alongwith associations) to make sure changes in your detached object are translated to the entity context. The caveats of this approach are:
    1. Read before update
    2. Stale writes (since all properties from detached object get updated, we might end up updating a staler value since we dont what really we changed)

    I dont think there is any way to avoid 1. But if 2. is critical to your business requirements (meaning you cant afford to overwrite with stale values, keep track of fields you are changing by “IsChangedProperty” and update only those fields. This is very painful but unfortunately with detached objects neither EF v4 nor v1 gives you any respite 🙁

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

Sidebar

Related Questions

I am using Struts + Velocity in a Java application, but after I submit
I am using a Velocity template, and when I use a variable with an
I am using Spring MVC for my web application and I am integrating Velocity
I am using velocity engine template for mailing in struts1 and hibernate configuration. I
We are using Apache Velocity for website templates and some of them are getting
When i try to initialize velocity engine using VelocityEngine engine = new VelocityEngine(); engine.init();
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
We have a data driven ASP.NET website which has been written using the standard

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.