change-tracking

WCF, Entity Framework 4.1 and Entity's State

☆樱花仙子☆ 提交于 2020-01-06 05:39:06
问题 I am developing an application which will expose WCF services. I am using Entity Framework 4.1 at the DAL. The problem is when I load some entity (let say a Customer that has Order which in turn has OrderDetail). After loading it I make some changes in Customer, Order and OrderDetail objects (some new orders are added and some existing orders are removed/updated) and send the object graph to WCF service to update it as following. Customer oCustomer; using(var context = new MyContext) /

Trying to understand some SQL Server change tracking features

爷,独闯天下 提交于 2020-01-04 09:15:33
问题 I'm working on SQL Server 2016 SP1 with the Change Tracking feature and I have a question for you. I have a database which has Change Tracking enabled. That database contains a table Table which has "change tracking" activated, but not "track columns updated" option. For the example, on Table , I only have one column called Id of type is "uniqueidentifier", which is my PK. On start, my change tracking current version is 0. I got it with : SELECT CHANGE_TRACKING_CURRENT_VERSION(); I added a

MySQL database change tracking

半世苍凉 提交于 2020-01-02 07:05:27
问题 What tools are you using to track changes in your MySQL database? Currently I'm in a project where we use a plain text-file (version controlled via SVN) in which we manually add SQL statements when making changes to the database. Many of the changes magically disappears every now and then, and we are now looking for a better way to change track our database. EDIT: One thing that I forgot to mention, we are using stored procedures and functions, so it's not only the database structure that we

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

被刻印的时光 ゝ 提交于 2019-12-30 08:09:07
问题 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 copy of the 'real table' (all of the fields of the original table, plus date/time, user ID, and DML action field) inserted into by Triggers" ... setup for a database table audit trail, where the trigger populates the audit trail table (which is all

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

折月煮酒 提交于 2019-12-30 08:08:02
问题 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 copy of the 'real table' (all of the fields of the original table, plus date/time, user ID, and DML action field) inserted into by Triggers" ... setup for a database table audit trail, where the trigger populates the audit trail table (which is all

Turn off EF change tracking for any instance of the context [duplicate]

北慕城南 提交于 2019-12-28 06:28:16
问题 This question already has answers here : Global setting for AsNoTracking()? (5 answers) Closed 6 years ago . 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 way to set the AsNoTracking bit so that just new ing up the ReportingContext above would automatically use AsNoTracking instead of needing to

Updating Elastic Search index when SQL Server table changes

梦想的初衷 提交于 2019-12-13 04:56:33
问题 What is the best way to know when an Elastic Search index needs updating, assuming the upstream data source is transactional SQL Server tables with inserts, updates and deletes? Examples: Tables Parent, Child, Grandchild. Parent | Child | Grandchild ID Name | ID ParentID Name | ID ChildID Amount 1 Foo | 10 1 Bike | 100 10 5 2 Bar | 20 1 Car | 200 20 2 3 Baz | 30 3 Tran | 300 30 1 Grandchild is updated, and Elastic Search index on Parent needs to be updated for the associated record. So, on

Using change tracking on a table that has his records constantly deleted and re-inserted

て烟熏妆下的殇ゞ 提交于 2019-12-13 04:41:14
问题 I'm building a layer over an application that needs to catch the changes happens to the data and update another system with these changes (SIF) and I faced a problem with a specific table, the application truncates the table, and insert a new set of records every time the data reconciled. In order to solve this problem, I used a shadow table and Merged the records from the original table, and as I found that I might use the same method with other tables in the future, I created a generic SP

Insert instead of update for history data?

爱⌒轻易说出口 提交于 2019-12-11 20:58:17
问题 I am using EF 6.1 Code First and want to track history data by using a model which (simplified) looks like this: public class Customer : IHistoryData<CustomerData> { public Guid ID { get; set; } public virtual ISet<CustomerData> Versions { get; set; } } public class CustomerData : HistoricalData { public string Name { get; set; } } public interface IHistoryData<T> where T : HistoricalData { ISet<T> Versions { get; set; } } public class HistoricalData { public int VersionID { get; set; }

ChangeTracker.Entries<T> not returning entries with entities of Type T

谁说胖子不能爱 提交于 2019-12-11 15:11:39
问题 using EF 4.3.1 in SaveChanges(), i'm trying to get a list of all entries for entities which implement a specific interface. My entities implement multiple interfaces, one of which is IAuditable. The following doesn't return any entries, even though entries with entities of type IAuditable do exist. var auditableEntities = ChangeTracker.Entries<IAuditable>().Where( e => e.State == EntityState.Modified | e.State == EntityState.Added); 来源: https://stackoverflow.com/questions/12970257