Remove related entity and Fk / setting fk to null

Posts   
 
    
petrutz
User
Posts: 10
Joined: 01-Sep-2008
# Posted on: 04-Feb-2011 13:43:35   

I'm probably missing something really simple but I just can't find find the way for this to work.

I do load an entity form the DB

PMEntity iPM = new PMEntity((Int64)e.Argument);

Then I do load a related entity from the DB

iPM.C = (CEntity) adapter.FetchNewEntity(new CEntityFactory(), iPM.GetRelationInfoC());

I even change the value of that FK to a different one by simply

iPM.idC = 3;

But I'm just unable to figure how to set it to null.

iPM.idC = null; //is not working as it is long not long?

iPM.C = null; //does not remove the iPM.idC nor set it to null

What I'm doing wrong?

Thank you!

petrutz
User
Posts: 10
Joined: 01-Sep-2008
# Posted on: 04-Feb-2011 13:50:42   

After looking at the C# code for like 2 hours just had a look at the db and the field was set to not null. flushed

I think you can safely delete this thread.