public AccessResult <Boolean> UnregisterForProfileChanges(TransactionObject transactionObject
                                                                  , ChangeNotificationObject changeNotificationObject
                                                                  , Boolean commitTransactionImplicitly)
        {
            if (m_CurrentTransaction != transactionObject)
            {
                return(new AccessResult <Boolean>(WrongTransaction));
            }

            lock (m_TransactionLock)
            {
                PauseTimer();

                if (changeNotificationObject == null)
                {
                    CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                    return(new AccessResult <Boolean>("changeNotificationObject is null"));
                }

                m_Notifications.Remove(changeNotificationObject);

                CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                return(new AccessResult <Boolean>(true));
            }
        }
        public override Boolean Equals(Object obj)
        {
            ChangeNotificationObject other = obj as ChangeNotificationObject;

            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            return(Id == other.Id);
        }
        public AccessResult <ChangeNotificationObject> RegisterForProfileChanges(TransactionObject transactionObject
                                                                                 , Boolean commitTransactionImplicitly)
        {
            if (m_CurrentTransaction != transactionObject)
            {
                return(new AccessResult <ChangeNotificationObject>(WrongTransaction));
            }

            lock (m_TransactionLock)
            {
                ChangeNotificationObject changeNotificationObject = new ChangeNotificationObject();

                m_Notifications.Add(changeNotificationObject, new List <String>());

                CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                return(new AccessResult <ChangeNotificationObject>(changeNotificationObject));
            }
        }
        public AccessResult <List <String> > PollChangedProfiles(TransactionObject transactionObject
                                                                 , ChangeNotificationObject changeNotificationObject
                                                                 , Boolean commitTransactionImplicitly)
        {
            if (m_CurrentTransaction != transactionObject)
            {
                return(new AccessResult <List <String> >(WrongTransaction));
            }

            lock (m_TransactionLock)
            {
                PauseTimer();

                if (changeNotificationObject == null)
                {
                    CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                    return(new AccessResult <List <String> >("changeNotificationObject is null"));
                }

                List <String> changedProfiles;
                if (m_Notifications.TryGetValue(changeNotificationObject, out changedProfiles) == false)
                {
                    CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                    return(new AccessResult <List <String> >("changeNotificationObject is not registered"));
                }

                //We need to clone the list here, so we can then clear it
                List <String> returnValue = new List <String>(changedProfiles);

                changedProfiles.Clear();

                CommitOrStartTimer(transactionObject, commitTransactionImplicitly);

                return(new AccessResult <List <String> >(returnValue));
            }
        }