Revert Entity Framework 4 POCO Changes

I am using Entity Framework 4.0 POCO with WPF. I have a form displaying an object to a user with many, many relationships, such as:

public class BPartner : BaseEntity
{
    public string Name 
    { 
        get { return name; } 
        set 
        { 
            if (name != value) 
            {
                name = bpartnerValidatorLight.ValidateName(value); 
                OnPropertyChanged("Name",true); 
            } 
        } 
    }
    public virtual ObservableCollection<BPAddress> BPAddresses { get; set; }

}

public class BPAddress : BaseEntity
{
    public string Line1 
    { 
        get 
        { 
            return line1; 
        } 
        set 
        { 
            if (line1 != value) 
            {
                line1 = bpAddressValidatorLight.ValidateLine1(value); 
                OnPropertyChanged("Line1",true); 
            } 
        } 
    }

    public virtual City City 
    { 
        get { return city; } 
        set 
        { 
            if (city != value) 
            {
                city = value; 
                OnPropertyChanged("City"); 
            } 
        } 
    }
}

BPAddresses "" BPartner. BPArtner, "" "" . , "" , Entity Framework , . , . :  1. objectContext, , . , Entity Framework , , , "" , "".  2.
         repoBPartner.Refresh(..);

       IQueryable<BPAddress> query = from e in addressRepo.AsQueryable()

                where e.BPartnerId == bp.Id
                select e;
        ObjectQuery<BPAddress> objectQuery = (ObjectQuery<BPAddress>)query;
        objectQuery.Include("City");
        objectQuery.Include("Country");
          ObjectResult<BPAddress> result =  (ObjectResult<BPAddress>)objectQuery.Execute(MergeOption.OverwriteChanges);
        bp.BPAddresses = new System.Collections.ObjectModel.ObservableCollection<BPAddress>(result.ToList<BPAddress>());

      The problem here is that "City" property does not get refreshed. 
 3. Tried: objectContext.LoadProperty(bp, "BPAddresses", MergeOption.OverwriteChanges);

. ?

.

, .

+3
1

EF . EF , , , .

, Entity Framework , , , , .

, , , . . , .

. , - , .

+2

All Articles