/// <summary>
        /// Create new Tracking Iterator for root entity of type {TEntity}
        /// </summary>
        /// <typeparam name="TEntity">Type of root entity</typeparam>
        /// <param name="entity">Root entity</param>
        /// <returns>STE Graph Iterator</returns>
        internal static ChangeTrackerIterator Create <TEntity>(TEntity entity)
            where TEntity : IObjectWithChangeTracker
        {
            ChangeTrackerIterator iterator = new ChangeTrackerIterator();

            iterator.Visit(entity);

            return(iterator);
        }
Beispiel #2
0
 /// <summary>
 /// Accept all changes in all entities associated with <paramref name="entity"/>
 /// </summary>
 /// <param name="entity">Root entity</param>
 public static void AcceptAllChanges(this IObjectWithChangeTracker entity)
 {
     using (ChangeTrackerIterator iterator = ChangeTrackerIterator.Create(entity))
         iterator.Execute(ste => ste.AcceptChanges());
 }
Beispiel #3
0
 /// <summary>
 /// Stop tracking in all entities associated with <paramref name="entity"/>
 /// </summary>
 /// <param name="entity">Root entity</param>
 public static void StopTrackingAll(this IObjectWithChangeTracker entity)
 {
     using (ChangeTrackerIterator iterator = ChangeTrackerIterator.Create(entity))
         iterator.Execute(ste => ste.StopTracking());
 }