Does Entity Framework innately support any sort of change tracking in terms of detecting which records in a database were added after some date x and which were added before some date x? I know it supports tracking changes in the properties of entities themselves, but this is a bit different, I think.
If not in Entity Framework, I’m wondering what would be recommended for a simple way to achieve this.
The scenario would be that automatic push-based data transfers are occurring say, every hour, and each time a push is initiated the server has to know which records have been added since the last push, and push those.
Does anyone know a standard and reliable approach to this? I’ve created my own solutions (watching primary keys, DateTime columns, etc.) but would rather not reinvent the wheel.
The feature you’re looking for are exactly Change Tracking (tracks the rows changed for sync like scenarios) and/or Change Data Capture (tracks exactly what changes, including pre-change image of data, for more complex scenarios like audit). There is a comparison of the two at Comparing Change Data Capture and Change Tracking, which covers also the main scenarios each of these two addresses. Note that ‘roll your own’ does not work because you need special support in the engine to either detect certain kind of changes, or prevent operations that would result in breaking the change tracking.
Entity Framework has nothing to do with these operations.