views:

42

answers:

1

Hi,

I have an object called Account, which has a reference to a timezone through a foreign-key relationship. On the Account-object I can see the TimeZone_Fk_Id as well as the reference to both Account.TimeZone and Account.TimeZoneReference.

I am trying to update the foreign key relationship but I cannot figure out how. I have tried all sorts of things. I have tried setting the TimeZone_Fk_Id directly, tried setting the Account.TimeZone to a new timezone, tried updating the entitykeys etc etc. But nothing seems to work. I don't get any exceptions, but when I check the timezone after I supposedly have changed it, it is still the old value.

Any help is greatly appreciated

thanks Thomas

A: 

Have you tried something like

Account account;
TimeZone timeZone;  
//Get account instance  
//Get timeZone instance to update  
account.TimeZone = timeZone;  
context.SaveChanges();
Devart
I figured it out, and it was a mistake in my coding. Before saving the changes, I was comparing the timezone-setting with the original timezone-setting. In this proces, the new timezone-setting was being reset to the old one.
Thomas