Пример #1
0
        private void FixupReceiver(User previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.QuestionsToMe.Contains(this))
            {
                previousValue.QuestionsToMe.Remove(this);
            }

            if (Receiver != null)
            {
                if (!Receiver.QuestionsToMe.Contains(this))
                {
                    Receiver.QuestionsToMe.Add(this);
                }

                id_receiver = Receiver.id;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Receiver")
                    && (ChangeTracker.OriginalValues["Receiver"] == Receiver))
                {
                    ChangeTracker.OriginalValues.Remove("Receiver");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Receiver", previousValue);
                }
                if (Receiver != null && !Receiver.ChangeTracker.ChangeTrackingEnabled)
                {
                    Receiver.StartTracking();
                }
            }
        }
Пример #2
0
        private void FixupUser(User previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.Transacs.Contains(this))
            {
                previousValue.Transacs.Remove(this);
            }

            if (User != null)
            {
                if (!User.Transacs.Contains(this))
                {
                    User.Transacs.Add(this);
                }

                userId = User.id;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("User")
                    && (ChangeTracker.OriginalValues["User"] == User))
                {
                    ChangeTracker.OriginalValues.Remove("User");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("User", previousValue);
                }
                if (User != null && !User.ChangeTracker.ChangeTrackingEnabled)
                {
                    User.StartTracking();
                }
            }
        }
Пример #3
0
        private void FixupOwner(User previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.MyQuestions.Contains(this))
            {
                previousValue.MyQuestions.Remove(this);
            }

            if (Owner != null)
            {
                if (!Owner.MyQuestions.Contains(this))
                {
                    Owner.MyQuestions.Add(this);
                }

                id_owner = Owner.id;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Owner")
                    && (ChangeTracker.OriginalValues["Owner"] == Owner))
                {
                    ChangeTracker.OriginalValues.Remove("Owner");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Owner", previousValue);
                }
                if (Owner != null && !Owner.ChangeTracker.ChangeTrackingEnabled)
                {
                    Owner.StartTracking();
                }
            }
        }