Release Notes for Trackable Entities v 2.0.0
Trackable Entities currently requires the Entity Framework Power Tools
. Support may be added in a future release for Code First from Database with the EF 6.1 Tools for Visual Studio. As of v 2.0 Trackable Entities no longer uses MVC scaffolding
for adding customized Web API controllers. Instead you must select Add New Item
and choose "Entity Web API Controller".1. Support for 1-M, 1-1, M-1 and M-M Relationships.
2. Change tracker MergeChanges has been refactored into a new method overload (with the v1 method marked as obsolete).
- Both client and server libraries have been updated to support all entity relations, including One-to-Many, One-to-One, Many-to-One, and Many-to-Many.
- Reference properties are now change-tracked on the client side, including any downstream changes on the object graph. For example, Order.Customer will be marked as modified if CustomerName is changed, and if Customer has reference or child entities, those will also be change-tracked and updated.
- Note that adding or removing reference properties currently requires manually marking the entity as Added or Deleted, but this requirement may be removed in the future.
- On the server-side, ApplyChanges walks the entire object graph in all directions. Cyclical references are detected to avoid infinite loops, and adding or removing children of Many-to-Many relations will remove the relation without inserting or deleting the related entity.
3. HasChanges and Clone methods have been added to the change tracker.
- Changes from an update operation can be merged back into the original object graph without replacing existing objects.
- Client entities now implement IEquatable using a Guid identifier to correlate updated entities to original entities in the object graph, which means that the position of entities, including that of added items, will be preserved.
4. LoadRelatedEntities had been added as an extension method to DbContext.
- HasMethods returns true if a change (modify, add or remove) is detected anywhere in the object graph.
- The Clone method performs a deep copy of all objects in the change tracker, providing a snapshot in time of the change tracker, which can be reverted to if you wish to discard changes.
5. Support for Entity Framework v 6.1.
- This method is called after an insert or update service operation has been performed, in order to load reference properties for added items.
- This allows for more efficient transmission of entity changes across the wire from client to service and back.
- This alleviates the need to call LoadProperty on ObjectContext to populate properties, which is highly inefficient.
- The asynchronous version executes database queries using EF6's async capabilities.
6. Updated Templates and Samples.
- All packages now reference the EF 6.1 runtime.
7. Miscellaneous Issues.
- Client T4 code-generation templates have been updated to support change-tracking of reference properties.
- Both client and service T4 templates have been updated to support correlation of entities with an entity identifier for merging changes after performing updates.
- Web API controller and WCF service type templates have been updated to call LoadRelatedEntities on Create and Update operations.
- A WebApi.Relations sample has been added to demonstrate how to use the change tracking API for updates to 1-1, M-1, and M-M relationships.
- All samples have been updated to use the latest templates and NuGet packages.
- An ExcludedProperties member has been added to the change tracker so that changes to specified properties will not result in an entity being marked as Modified.
- Overloads have been added to various methods which accept multiple entities.
- Various bugs have been fixed, including where multiple properties were not added to ModifiedProperties when more than one property was updated.
- Mapping.tt template was modified to include a using directive for the System.ComponentModel.DataAnnotations.Schema namespace.
- VSIX installers have been updated with new templates and NuGet packages, and the item template dialogs have been improved.
- Numerous unit tests have been added to improve code coverage.
- Trackable Entities Visual Studio Extension has been tested for compatibility with Visual Studio 2013 Update 2.