private static void HandlePostTransaction(MaterialCMSSession session) { while (GetNextAddedEventInfoForPostTransaction(session) != null) { EventInfo obj = GetNextAddedEventInfoForPostTransaction(session); obj.PostTransactionHandled = true; Publish(obj, session, typeof(IOnAdded <>), (info, ses, t) => info.GetTypedInfo(t).ToAddedArgs(ses, t)); } while (GetNextUpdatedEventInfoForPostTransaction(session) != null) { UpdatedEventInfo obj = GetNextUpdatedEventInfoForPostTransaction(session); obj.PostTransactionHandled = true; Publish(obj, session, typeof(IOnUpdated <>), (info, ses, t) => info.GetTypedInfo(t).ToUpdatedArgs(ses, t)); } while (GetNextDeletedEventInfoForPostTransaction(session) != null) { EventInfo obj = GetNextDeletedEventInfoForPostTransaction(session); obj.PostTransactionHandled = true; Publish(obj, session, typeof(IOnDeleted <>), (info, ses, t) => info.GetTypedInfo(t).ToDeletedArgs(ses, t)); } }
private static void HandlePreTransaction(MaterialCMSSession session) { HashSet <EventInfo> eventInfos = session.Added.ToHashSet(); eventInfos.ForEach(obj => { if (obj.PreTransactionHandled) { return; } obj.PreTransactionHandled = true; Publish(obj, session, typeof(IOnAdding <>), (info, ses, t) => info.GetTypedInfo(t).ToAddingArgs(ses, t)); }); HashSet <UpdatedEventInfo> updatedEventInfos = session.Updated.ToHashSet(); updatedEventInfos.ForEach(obj => { if (obj.PreTransactionHandled) { return; } obj.PreTransactionHandled = true; Publish(obj, session, typeof(IOnUpdating <>), (info, ses, t) => info.GetTypedInfo(t).ToUpdatingArgs(ses, t)); }); HashSet <EventInfo> hashSet = session.Deleted.ToHashSet(); hashSet.ForEach(obj => { if (obj.PreTransactionHandled) { return; } obj.PreTransactionHandled = true; Publish(obj, session, typeof(IOnDeleting <>), (info, ses, t) => info.GetTypedInfo(t).ToDeletingArgs(ses, t)); }); }
public MaterialCMSTransaction(ITransaction transaction, MaterialCMSSession session) { _transaction = transaction; _session = session; }
private static EventInfo GetNextDeletedEventInfoForPostTransaction(MaterialCMSSession session) { return(session.Deleted.FirstOrDefault(x => !x.PostTransactionHandled)); }