void OnAfterDeleteWrapper(string key, bool isManagerCall) { if (isManagerCall) { return; } ThreadHelper.RunOnDifferentThread(() => { OnAfterDelete?.Invoke(key); }, true); }
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(); } }
/// <summary> /// Raises the OnAfterDelete event. /// </summary> private void RaiseOnAfterDelete() { OnAfterDelete?.Invoke(this, EventArgs.Empty); }