Пример #1
0
 public virtual void StartTracking()
 {
     if (ChangeTracker.ChangeTrackingEnabled)
     {
         return;
     }
     ChangeTracker.ChangeTrackingEnabled = true;
     if (NewsCategory != null)
     {
         NewsCategory.StartTracking();
     }
 }
Пример #2
0
        private void FixupNewsCategory(NewsCategory previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

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

            if (NewsCategory != null)
            {
                if (!NewsCategory.News.Contains(this))
                {
                    NewsCategory.News.Add(this);
                }

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