Nullable fields

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 25-Jan-2005 11:56:21   

Greetings, The EntityBase2 has a PrimaryKeyFields arraylist that contains all the entity's primary key fields. Is there a way to know what are the Nullabel fields for an entity. I know that an EntityField2 has the IsNull property that determines

If the original value in the column for this entityfield is DBNull (NULL)

but what I really want to know is the field table behavior characteristics which are described in the commnets in the generated code

        ' /// <summary>
        ' /// The DtmDateEnteredSR property of the Entity GLMoneyWithdrawal<br/><br/>
        ' /// 
        ' /// MS_ColumnHidden: False<br/>
        ' /// MS_ColumnOrder: 0<br/>
        ' /// MS_ColumnWidth: 2340<br/>
        ' /// </summary>
        ' /// <remarks>
        ' /// Mapped on table field: "GLMoneyWithdrawal"."dtmDateEnteredSR"<br/>
        ' /// Table field type characteristics (type, precision, scale, length): DateTime, 23, 3, 0
        ' /// Table field behavior characteristics (is nullable, is PK, is identity): True, False, False
        ' /// </remarks>
        Public Overridable Property [DtmDateEnteredSR]() As System.DateTime
            Get
                Dim valueToReturn As Object = MyBase.GetCurrentFieldValue(CType(GLMoneyWithdrawalFieldIndex.DtmDateEnteredSR, Integer))
                If valueToReturn Is Nothing Then
                    valueToReturn = TypeDefaultValue.GetDefaultValue(GetType(System.DateTime))
                End If
                Return CType(valueToReturn, System.DateTime)
            End Get
            Set
                If MyBase.SetNewFieldValue(CType(GLMoneyWithdrawalFieldIndex.DtmDateEnteredSR, Integer), value) Then
                    ' value set. Set related entities to null (if any), related via this field


                    ' Flag as changed
                    OnDtmDateEnteredSRChanged()
                End If
            End Set
        End Property

Thanks

OMAR

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Jan-2005 16:35:14   

In adapter, these are stored in the persistenceinfo buckets produced by the PersistenceInfoFactory. Best is to add a method to a derived class of DataAccessAdapter and to read the buckets there based on the input and return true/false for nullable.

Frans Bouma | Lead developer LLBLGen Pro