Exemple #1
0
        private static void HandlePostTransaction(MrCMSSession 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));
            }
        }
Exemple #2
0
        private static void HandlePreTransaction(MrCMSSession 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));
            });
        }
Exemple #3
0
 public MrCMSTransaction(ITransaction transaction, MrCMSSession session)
 {
     _transaction = transaction;
     _session     = session;
 }
Exemple #4
0
 private static EventInfo GetNextDeletedEventInfoForPostTransaction(MrCMSSession session)
 {
     return(session.Deleted.FirstOrDefault(x => !x.PostTransactionHandled));
 }