FieldNamesKeepEmptyStringAsValue request

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 20-Jan-2007 21:36:33   

Frans:

I'm in the same camp as Rocky Lhotka regarding database fields and null values. That is, if we don't care about the difference between an empty string and a null, use the empty string. So I'm getting tired of FieldNamesKeepEmptyStringAsValue and looping through the fields to build a list of the ones that should keep "" as the value.

I'd like to see a global property (set at code generation time) or a declarative property on the LLBLGenDataSource such as AllFieldsKeepEmptyStringsAsValue. I'd even be OK if the default was false.

My current approach is to call a helper function:

    Sub setStringFields(ByRef entity As IEntity2, ByRef dataSource As LLBLGenProDataSource2) 
        Dim stringList As New System.Collections.Generic.List(Of String)()

        For Each fld As IEntityField2 In entity.Fields
            If fld.DataType.ToString.ToLower.EndsWith("string") Then
                stringList.Add(fld.Name)
            End If
        Next

        dataSource.FieldNamesKeepEmptyStringAsValue = stringList

    End Sub

If you've got a better suggestion, I'll be happy to try it.

Joel Reinford Data Management Solutions LLC

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Jan-2007 19:13:14   

I think a property on the datasource control is best. I'll add that in v2.1. Thanks for the suggestion simple_smile

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 21-Jan-2007 22:13:08   

Great, I'll be happy to see it. It was annoying because the parameters have the property but there was no way to set at a higher level.

Joel