Exemplo n.º 1
0
 /// <summary>
 /// Called after a add data database command execute
 /// </summary>
 /// <typeparam name="T">Data type</typeparam>
 /// <param name="addDataContext">Add data context</param>
 public virtual void OnAddCallback <T>(AddDataContext <T> addDataContext) where T : BaseEntity <T>, new()
 {
     if (addDataContext == null)
     {
         return;
     }
     AddCacheData(new QueryDataCallbackContext <T>()
     {
         Datas = addDataContext.Datas,
         Query = addDataContext.DatabaseCommand?.Query
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// Called before a database command execute
 /// </summary>
 /// <param name="addDataContext">Add data context</param>
 /// <returns>Return the policy result</returns>
 public virtual StartingResult OnAddStarting <T>(AddDataContext <T> addDataContext) where T : BaseEntity <T>, new()
 {
     if (addDataContext == null)
     {
         return(StartingResult.Success($"Parameter:{nameof(addDataContext)} is null"));
     }
     try
     {
         AddCacheData(new QueryDataCallbackContext <T>()
         {
             Datas = addDataContext.Datas,
             Query = addDataContext.DatabaseCommand?.Query
         });
     }
     catch (Exception ex)
     {
         return(DataCacheBehavior.GetStartingResult(DataCacheOperation.AddData, ex));
     }
     return(StartingResult.Success());
 }