Related entity properties

Posts   
 
    
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 12-Apr-2007 17:53:42   

I'm using 1.0.2005.1 (July 6)

Say I have an Employee entity and a Manager entitity. Employee has a relation with Manager through Employee.Manager_ID, and also a property Employee.Manager. If I set Employee.Manager_ID to a value, then set Employee.Manager to 'Nothing' then the Manager_ID field is not updated, as opposed to when I set the Employee.Manager property to a real entity object, in which case the Manager_ID field is updated.

Why is this? If I set Employee.Manager to 'Nothing' shouldn't Employee.Manager_ID become whatever translates into null when it hits the database?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39926
Joined: 17-Aug-2003
# Posted on: 13-Apr-2007 18:44:40   

Yes, this is indeed true. We couldn't fix it without breaking code in 1.0.2005.1, so we had to postpone this fix to v2.0.

The workaround is to set the FK field to a different value instead. This dereferences the entity as well (sets it to null)

Frans Bouma | Lead developer LLBLGen Pro
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 13-Apr-2007 20:24:52   

Otis wrote:

Yes, this is indeed true. We couldn't fix it without breaking code in 1.0.2005.1, so we had to postpone this fix to v2.0.

The workaround is to set the FK field to a different value instead. This dereferences the entity as well (sets it to null)

Thats what I ended up doing. Thanks for the reply... simple_smile