Null to empty string

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 10-Apr-2013 16:34:41   

Hi, i had a problem with a telerik control that takes DataFieldId and DataFieldParentId properties. Binding an entity collection to the control returns nothing and yet binding a data table works just fine.

Contacted telerik support and they said binding entity collection on their end works just fine. I did debug my side and found out that llblgen converts nulls into empty strings and telerik control does not like that. It expects a null for DataFieldParentId if the item is not a child item.

Is this the default behavior for entity collection? Why would it convert null into empty string? And is there a setting to change this behavior if needed?

thanks -shane

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 10-Apr-2013 18:51:22   

Web binding, winforms, wpf?

Frans Bouma | Lead developer LLBLGen Pro
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 10-Apr-2013 19:17:31   

Otis wrote:

Web binding, winforms, wpf?

web binding.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 10-Apr-2013 19:48:14   

I assume "DataFieldParentId" is an EntityField, correct? And I assume it should hold int? values, correct?

Which runtime library version are you using? (please check the forum guidelines).

e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 10-Apr-2013 19:59:18   

Walaa wrote:

I assume "DataFieldParentId" is an EntityField, correct? And I assume it should hold int? values, correct?

Which runtime library version are you using? (please check the forum guidelines).

i have the latest i believe, the one that is Jan 17, 2013 dated (3.5.13.0108 ). Yes it is an EntityField and no, it is of type string that allows null obviously.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 10-Apr-2013 20:09:04   

Please check the setting "Convert nulled reference types to default value" In the Designer's Project Settings, under "LLBLGen Pro Settings" section.

e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 10-Apr-2013 21:02:35   

Walaa wrote:

Please check the setting "Convert nulled reference types to default value" In the Designer's Project Settings, under "LLBLGen Pro Settings" section.

Found it, thanks. Now i am not sure if changing this would break other parts of the application so i ll leave it as is.

Is there a way to overwrite this while creating the collection? Something like myCollection.GetMulti(....., ConvertNullToDefaultValue: false)

thanks again

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Apr-2013 08:32:34   

e106199 wrote:

Is there a way to overwrite this while creating the collection? Something like myCollection.GetMulti(....., ConvertNullToDefaultValue: false)

No, there is not such overload. You should change the setting, or look into a way the control can live with nulls on those fields.

David Elizondo | LLBLGen Support Team