Questions tagged [change-tracking]

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

356 questions
76
votes
8 answers

Global setting for AsNoTracking()?

Originally I believed that context.Configuration.AutoDetectChangesEnabled = false; would disable change tracking. But no. Currently I need to use AsNoTracking() on all my LINQ queries (for my read only layer). Is there a global…
Vindberg
  • 1,502
  • 2
  • 15
  • 27
50
votes
1 answer

How change tracking works in Entity Framework

Given the following code, how does EF/DbContext knows about the change made to the customer object: class Program { static void Main() { using(var shopContext = new ShopContext()) { var customer =…
Yair Nevet
  • 12,725
  • 14
  • 66
  • 108
40
votes
4 answers

Database Design with Change History

I am looking to design a database that keeps track of every set of changes so that I can refer back to them in the future. So for example: Database A +==========+========+==========+ | ID | Name | Property | 1 Kyle 30 If…
Delos Chang
  • 1,823
  • 3
  • 27
  • 47
33
votes
1 answer

Turn off EF change tracking for any instance of the context

I have a context to a read-only database for reporting and I am writing lots of code, like this: using (var context = new ReportingContext()) { var reportXQuery = context.ReportX.AsNoTracking(); // Do stuff here with query... } Is there a…
Karl Anderson
  • 34,606
  • 12
  • 65
  • 80
31
votes
2 answers

Entity Framework 4.1+ many-to-many relationships change tracking

How can I detect changes of ICollection<> properties (many-to-many relationships)? public class Company { ... public virtual ICollection Employees { get; set; } } using (DataContext context = new…
31
votes
2 answers

DbContext ChangeTracking kills performance?

I am in the process of upgrading an application from EF1 to EF4.1 I created a DbContext and a set of POCOs using the "ADO.NET DbContext Generator" templates. When I query the generated DbContext the database part of the query takes 4ms to execute…
Sebastian Weber
  • 6,766
  • 2
  • 30
  • 49
26
votes
7 answers

What is the best architecture for tracking field changes on objects?

We have a web application that is built on top of a SQL database. Several different types of objects can have comments added to them, and some of these objects need field-level tracking, similar to how field changes are tracked on most…
Nicole
  • 32,841
  • 11
  • 75
  • 101
22
votes
4 answers

Is there a object-change-tracking/versioning Java API out there?

I know of at least two byte-code enhancer that modify the "object model" at runtime to allow transaction to be performed transparently. One of them is part of Versant VOD, which I use at work every day, and the other is part of Terracotta. There are…
Sebastien Diot
  • 7,183
  • 6
  • 43
  • 85
17
votes
1 answer

EF 4.1 Code First - Determine What Properties Have Changed

I'm using Entity Framework 4.1 Code First. Is there a built-in way to get a list of what properties have changed since the entity was loaded from the database? I know code first detects that an object was changed, but is there a way to get exactly…
Dylan Vester
  • 2,686
  • 4
  • 29
  • 40
17
votes
2 answers

Support SQL Server change tracking with Entity Framework 6

I have an Entity Framework 6 Code First model generated from an existing SQL Server database. The database is using SQL Server Change Tracking, so for all the data manipulation operations generating from EF, I want to set the Change Tracking context…
bilal.haider
  • 318
  • 1
  • 4
  • 18
13
votes
3 answers

Entity framework change tracking after calling ToList()

I am struggling to understand something with change tracking in EF6. I have code similar to this. public class SomeClass { private List _users; private DAL _dal; public void ProcessUsers() { _users = _dal.GetUsers(); …
D3vy
  • 831
  • 7
  • 19
11
votes
7 answers

ORM and SOA in the .NET world

From my experience the major ORM frameworks for .NET (NHibernate, LinqToSql, Entity Framework) work best when they keep track of loaded objects. This works fine for simple client-server applications, but when using three- or more tier architecture…
Rumen Georgiev
  • 702
  • 4
  • 23
11
votes
2 answers

Why we require temporal table in SQL Server 2016 as we have CDC or CT?

What advantages do Temporal Tables have over Change Data Capture or Change Tracking in SQL Server?
11
votes
1 answer

Change Data Capture or Change Tracking - Same as Traditional Audit Trail Table?

Before I delve into the abyss of Microsoft documentation any deeper, I'd like to know if someone experienced with Change Data Capture and Change Tracking know if one or both of these can be used to replace the traditional ... "Audit trail table…
11
votes
3 answers

INotifyPropertyChanging and validations: when do I raise PropertyChanging?

INotifyPropertyChanged is fairly self explanatory and I think I'm clear on when to raise that one (i.e. when I've finished updating the values). If I implement INotifyPropertyChanging I'm tending to raise the event as soon as I enter the setter or…
Hamish Smith
  • 8,153
  • 1
  • 34
  • 48
1
2 3
23 24