Minimal Table - SaveEntity

Posts   
 
    
obzekt
User
Posts: 60
Joined: 29-Apr-2004
# Posted on: 18-Aug-2004 15:51:05   

Hello. I have a table with only two columns: a PK IDENTITY and a binary one which allows NULL. I'm trying to save new entities but it doesn't work unless I set a value for the second column. This works:

AudioObjectEntity au = new AudioObjectEntity();
au.AudioData = Convert.FromBase64String("test");
adapter.SaveEntity(au);

This doesn't:

AudioObjectEntity au = new AudioObjectEntity();
adapter.SaveEntity(au);

In the above, no exception is thrown, just that no new record is created in the DB, although it should, since "AudioData" is not a required field. Any ideas?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 18-Aug-2004 16:21:39   

obzekt wrote:

Hello. I have a table with only two columns: a PK IDENTITY and a binary one which allows NULL. I'm trying to save new entities but it doesn't work unless I set a value for the second column. This works:

AudioObjectEntity au = new AudioObjectEntity();
au.AudioData = Convert.FromBase64String("test");
adapter.SaveEntity(au);

This doesn't:

AudioObjectEntity au = new AudioObjectEntity();
adapter.SaveEntity(au);

In the above, no exception is thrown, just that no new record is created in the DB, although it should, since "AudioData" is not a required field. Any ideas?

it doesn't fail but simply doesn't save anything as no field is changed, i.e. the entity isn't dirty.

binary would result in a byte[] property, so you could do: au.AudioData = null; adapter.SaveEntity(au);

which would save a record as AudioData is changed. Correct?

Frans Bouma | Lead developer LLBLGen Pro
obzekt
User
Posts: 60
Joined: 29-Apr-2004
# Posted on: 18-Aug-2004 16:45:00   

Thanks Otis, setting it to null works!