コード例 #1
0
        /// <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());
        }
コード例 #2
0
ファイル: EntityAdapter.cs プロジェクト: dox0/DotNet471RS3
        /// <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);
        }
コード例 #3
0
 /// <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;
 }