Exemplo n.º 1
0
        /// <summary>
        /// Called before a update database command execute
        /// </summary>
        /// <typeparam name="T">Data type</typeparam>
        /// <param name="updateAllContext">Update all context</param>
        /// <returns>Return policy result</returns>
        public virtual StartingResult OnUpdateAllStarting <T>(UpdateAllContext <T> updateAllContext) where T : BaseEntity <T>, new()
        {
            if (updateAllContext == null)
            {
                return(StartingResult.Success($"Parameter:{nameof(updateAllContext)} is null"));
            }
            var entityType = typeof(T);

            try
            {
                RemoveCacheDataByType(entityType);
            }
            catch (Exception ex)
            {
                return(DataCacheBehavior.GetStartingResult(DataCacheOperation.RemoveData, ex));
            }
            return(StartingResult.Success());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called after a update database command execute
 /// </summary>
 /// <typeparam name="T">Data type</typeparam>
 /// <param name="updateAllContext">Update all context</param>
 public virtual void OnUpdateAllCallback <T>(UpdateAllContext <T> updateAllContext) where T : BaseEntity <T>, new()
 {
     RemoveCacheDataByType(typeof(T));
 }