SaveEntity weird issue

Posts   
 
    
youkebb
User
Posts: 14
Joined: 14-May-2009
# Posted on: 20-Jul-2009 22:56:40   

Hi, I noticed that my adapter.SaveEntity(someEntity) is not working properly. Is it a bug from LLBLGen? The scenario is like following:

I have an entity, say CategoryEntity. It has a bunch of fields inside, 2 of which are defined in SQL as

LastReceivedTime (datetime, null) LastSentTime (datetime, null)

Now, in the code i called adapter.SaveEntity(categoryEntity) to create a new category, left LastReceivedTime and LastSentTime both to be null, expecting them not to be set in database.

Actually I am getting 1790-01-01 for LastReceivedTime and null for LastSentTime. I've double checked the passed in fields, LastReceivedTime = LastSentTime = null. Why my LastReceivedTime get changed?? Did I do something wrong? Also, not only on these 2 fields, I have some other fields being assigned value even though they were passed in as null. Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Jul-2009 05:18:41   

Please read Entities, NULL values and defaults to understand this.

Also, What LLBLGenPro version and RuntimeLibrary version are you using? (http://llblgen.com/TinyForum/Messages.aspx?ThreadID=7722)

Are you using Default Values on DB-Side? Could you post the DDL of that table? What is the Generated SQL executed?

David Elizondo | LLBLGen Support Team
youkebb
User
Posts: 14
Joined: 14-May-2009
# Posted on: 21-Jul-2009 16:58:55   

daelmo wrote:

Please read Entities, NULL values and defaults to understand this.

Also, What LLBLGenPro version and RuntimeLibrary version are you using? (http://llblgen.com/TinyForum/Messages.aspx?ThreadID=7722)

Are you using Default Values on DB-Side? Could you post the DDL of that table? What is the Generated SQL executed?

Thanks for the reply. I've review the link and found out I had a default value associated with the columns which are generating values. When the passed in value is NULL implicitly, that default value will be assigned. Interesting thing is I have to set the value explicitly to NULL in order to bypass this default value. If not, the default value will be assigned. Wondering if it's a sql feature or LLBLGen feature simple_smile anyway it has been solved. By the way i am using 2.6