Questions tagged [change-tracking]

Change tracking is the process of recording changes made to data as they are made.

356 questions
9
votes
2 answers

ChangeTracker Entity Framework 4.1 - Original Values of Related Objects

I have a base class that I inherit from that has two zero to many relationships with other entities: public abstract class WebObject { public WebObject() { RelatedTags = new List(); RelatedWebObjects = new…
DMC
  • 361
  • 4
  • 15
9
votes
4 answers

The instance of entity type 'Product' cannot be tracked because another instance with the same key value is already being tracked

I made a test with code below to update the Product: var existing = await _productRepository.FirstOrDefaultAsync(c => c.Id == input.Id); if (existing == null) throw new UserFriendlyException(L("ProductNotExist")); var updatedEntity =…
9
votes
2 answers

Ways to Maintain Data History in SQL Server 2008 Database

For a long time, we've wanted to create a case management system where no history is ever lost. When a change is made, we want to record that change, but have the ability to go back to any point in time and see what the record looked like. I wanted…
Dylan Vester
  • 2,686
  • 4
  • 29
  • 40
8
votes
1 answer

How do I turn off change tracking at the DbContext level in EF 4.1 RC?

I've encountered what seems to be a common problem: I am updating values in my database, but EF is using its original in-memory copy of the object and these changed values are not reflected in the displayed data. I understand why this is, but I…
8
votes
1 answer

Use EF changetracker to manually get set of changes?

If I load up an entity, make some changes, and then go to save it, EF generates an update statement. This must mean that at some point something (presumably the change tracker) is navigating the loaded object hierarchy and generating a list of…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
8
votes
3 answers

Entitity Framework: Change tracking in SOA with POCO approach

In our layered application, we are accessing database via WCF calls. We are creating and disposing contexts per request. Also we are using POCO approach. My question is, in pure POCO model (completely persistent ignorant POCOs) is it possible to…
rovsen
  • 4,932
  • 5
  • 38
  • 60
7
votes
1 answer

Entity Framework does not track collection changes when reconnecting an entity

I have been using a lot Entity Framework in a MVVM WPF application recently and I ran into some issues. To display data, my view-models are using a short-live ObjectContext. These view-models will be used in a long running process, therefore I…
Ucodia
  • 7,410
  • 11
  • 47
  • 81
7
votes
1 answer

Entity Framework Change Tracking API and reference entries

Looking to write generic Audit code on my DbContext subclass. foreach (var entry in this.ChangeTracker.Entries()) { if (entry.State == EntityState.Modified) { var entityProperties = entry.Entity.GetType().GetProperties(); …
user140628
7
votes
4 answers

Patterns for implementing field change tracking

For one of my recent projects, I had to implement field change tracking. So anytime the user changed a value of a field, the change was recorded in order to allow full auditing of changes. In the database, I implemented this as a single table…
David
  • 15,750
  • 22
  • 90
  • 150
7
votes
2 answers

Advice on Change Tracking in Sql Server 2008

My client is looking for a way to do a full audit trails (full view of historical data on all tables) on the application. Other than using the old fashioned way of having table copies or storing field name, field value, modified by, modified on…
Binoj Antony
  • 15,886
  • 25
  • 88
  • 96
7
votes
2 answers

Implementing object change tracking in an N-Tier WCF MVC application

Most of the examples I've seen online shows object change tracking in a WinForms/WPF context. Or if it's on the web, connected objects are used, therefore, the changes made to each object can be tracked. In my scenario, the objects are disconnected…
6
votes
6 answers

function to track the changes in a field

I need a function (using base SAS or RStudio) that will enable me to determine the ID numbers as of a certain date and the original (root) ID numbers as of the start date. The dataset includes the old ID, the new ID, and the date the ID changed. …
Reza
  • 59
  • 3
6
votes
1 answer

Retention period in SQL Server 2008 Change Tracking

I'm a little worried about the default retention period in SQL Server 2008 Change Tracking (which is 2 days). Is it a good idea to set this period to eg. 100 years and turn auto cleanup off or will it bite me back in the future with excessive…
Marek Stój
  • 4,075
  • 6
  • 49
  • 50
6
votes
1 answer

The ObjectContext instance has been disposed and can no longer be used for operations that require a connection

I'm having trouble with one of my queries because of EF's change tracking and lazy loading features. The thing is that after I'm getting the result of the query, I'm using AutoMapper to map the domain objects into my business model but it keeps…
5
votes
2 answers

How to make Excel a potent relational data source for manual entry?

I am using Excel to store data kind of as a relational database for data that will be entered manually (see my other question here : https://stackoverflow.com/questions/9416263/possible-solutions-for-simple-data-persistence-and-manual-entry) However…
1
2
3
23 24