/// <summary> /// Called before a remove database command execute /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="removeAllContext">Remove all context</param> /// <returns>Return policy result</returns> public virtual StartingResult OnRemoveAllStarting <T>(RemoveAllContext <T> removeAllContext) where T : BaseEntity <T>, new() { if (removeAllContext == null) { return(StartingResult.Success($"Parameter:{nameof(removeAllContext)} is null")); } var entityType = typeof(T); try { RemoveCacheDataByType(entityType); } catch (Exception ex) { return(DataCacheBehavior.GetStartingResult(DataCacheOperation.RemoveData, ex)); } return(StartingResult.Success()); }
/// <summary> /// Called after a remove database command execute /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="removeAllContext">Remove all context</param> public virtual void OnRemoveAllCallback <T>(RemoveAllContext <T> removeAllContext) where T : BaseEntity <T>, new() { RemoveCacheDataByType(typeof(T)); }