コード例 #1
0
 void OnAfterDeleteWrapper(string key, bool isManagerCall)
 {
     if (isManagerCall)
     {
         return;
     }
     ThreadHelper.RunOnDifferentThread(() => { OnAfterDelete?.Invoke(key); }, true);
 }
コード例 #2
0
 public virtual IActionResult DeleteEntity(string entityName, string entityId)
 {
     try
     {
         string requestName = $"{nameof(DeleteEntity)} : Entity Name = {entityName} : Entity ID = {entityId}";
         LogWebRequest(requestName, null);
         ValidateRequestMethod(HttpVerb.DELETE);
         string userName   = GetCurrentUserName();
         Type   entityType = GetEntityType(entityName);
         OnBeforeDelete?.Invoke(this, new NKitRestApiDeleteEntityEventArgs(entityName, userName, DbContext, entityType, entityId));
         DbContext.DeleteBySurrogateKey(entityId, null, entityType);
         OnAfterDelete?.Invoke(this, new NKitRestApiDeleteEntityEventArgs(entityName, userName, DbContext, entityType, entityId));
         string responseMessage = string.Format("{0} deleted successfully.", entityName);
         LogWebResponse(requestName, responseMessage);
         return(Ok(responseMessage));
     }
     finally
     {
         DisposeEntityContext();
     }
 }
コード例 #3
0
 /// <summary>
 /// Raises the OnAfterDelete event.
 /// </summary>
 private void RaiseOnAfterDelete()
 {
     OnAfterDelete?.Invoke(this, EventArgs.Empty);
 }