/// <summary> /// Determine whether the cache has changes to apply. /// </summary> /// <param name="entityCache"> ObjectStateManager to check. Must not be null. </param> /// <returns> true if cache contains changes entries; false otherwise </returns> private static bool IsStateManagerDirty(IEntityStateManager entityCache) { DebugCheck.NotNull(entityCache); // this call to GetCacheEntries is constant time (the ObjectStateManager implementation // maintains an explicit list of entries in each state) return(entityCache.GetEntityStateEntries(EntityState.Added | EntityState.Deleted | EntityState.Modified).Any()); }
/// <summary> /// Determine whether the cache has changes to apply. /// </summary> /// <param name="entityCache">ObjectStateManager to check. Must not be null.</param> /// <returns>true if cache contains changes entries; false otherwise</returns> private static bool IsStateManagerDirty(IEntityStateManager entityCache) { Debug.Assert(null != entityCache); bool hasChanges = false; // this call to GetCacheEntries is constant time (the ObjectStateManager implementation // maintains an explicit list of entries in each state) foreach (ObjectStateEntry entry in entityCache.GetEntityStateEntries( EntityState.Added | EntityState.Deleted | EntityState.Modified)) { hasChanges = true; break; } return(hasChanges); }
/// <summary> /// Determine whether the cache has changes to apply. /// </summary> /// <param name="entityCache">ObjectStateManager to check. Must not be null.</param> /// <returns>true if cache contains changes entries; false otherwise</returns> private static bool IsStateManagerDirty(IEntityStateManager entityCache) { Debug.Assert(null != entityCache); bool hasChanges = false; // this call to GetCacheEntries is constant time (the ObjectStateManager implementation // maintains an explicit list of entries in each state) foreach (ObjectStateEntry entry in entityCache.GetEntityStateEntries( EntityState.Added | EntityState.Deleted | EntityState.Modified)) { hasChanges = true; break; } return hasChanges; }