Deleting one to one relationship .Net
I have a Table called Group with a column "DefaultSubGroup" which is a one to one relationship to a table called SubGroup. I fail to set the relationship and clear it in the same session. Here are the steps that cause the problem.
1- DefaultSubGroup for MyGroup is initially null
2- Set DefaultSubGroup for MyGroup to a SubGroup "defaultSubGroup".
3- Save MyGroup
4- Clear DefaultSubGroup for MyGroup by setting it to null
5- Save MyGroup
After these steps somehow DefaultSubGroup for MyGroup remains set to defaultSubGroup object and is not cleared. If i refetch MyGroup Object then clear DefaultSubGroup it works.
Code for setting DefaultSubGroup
Code for clearing the relationship
Am I doing something wrong?