Setting field to null requires extra assignment

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 20-Oct-2005 18:52:28   

Hi there,

The Best Practices say that to set a property on an existing entity to null then one does something like this..


entity.SetNewFieldValue((int)NewsFieldIndex.NewsSectorId, null);

I have found that I need an extra assignment in order to get the the null value saved.

NewsEntity entity = new NewsEntity(myid); entity.IsNew = false;

entity.NewsSectorId = 1; entity.SetNewFieldValue((int)NewsFieldIndex.NewsSectorId, null);

Is this normal?

Cheers, I.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Oct-2005 21:13:13   

set IsNew = false after the null assignment.

Frans Bouma | Lead developer LLBLGen Pro