예제 #1
0
 void BAEntities_ObjectMaterialized(object sender, ObjectMaterializedEventArgs args)
 {
     if (args.Entity is Lodging)
     {
         Lodging lodging = (Lodging)args.Entity;
         lodging.Materialized();
     }
 }
예제 #2
0
        private void FixupLodging(Lodging previousValue)
        {
            if (previousValue != null && previousValue.Trips.Contains(this))
            {
                previousValue.Trips.Remove(this);
            }

            if (Lodging != null)
            {
                if (!Lodging.Trips.Contains(this))
                {
                    Lodging.Trips.Add(this);
                }
                if (LodgingID != Lodging.LodgingID)
                {
                    LodgingID = Lodging.LodgingID;
                }
            }
        }
        private void FixupLodging(Lodging previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

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

            if (Lodging != null)
            {
                if (!Lodging.Trips.Contains(this))
                {
                    Lodging.Trips.Add(this);
                }

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