BO Mapper Bug on FieldChanging event when allow null


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)StrataFrame VIP (1.7K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
I've come across a bug in BO Mapper when adding a FieldChanging event to a field that allows nulls. 
The following code was generated by the mapper. The "If value..." comparison always results to false,
since the value was set equal to the e.FieldValue in the prior line, resulting in the item always
being set to DBNull.
Set(ByVal value As System.Int32)
   Dim e As New TestBOFieldChangingEventArgs(TestBOFieldNames.ta_tst_idvalue)
   Me.OnFieldPropertyChanging(Mee)
   value = CType(e.FieldValue, System.Int32)
   If value <> CType(e.FieldValue, System.Int32Then <---- Always False
        Me.CurrentRow.Item("ta_tst_id") = value
   Else
       Me.CurrentRow.Item("ta_tst_id") = DBNull.Value
   End IfEnd Set
Since I've configured the item to be Return Alternate on Null / Set Null on Alternate to 0 
I believe the if statement should be "If value <> 0 Then" as it does when adding a FieldChanged event.
The following code was generated by the mapper for a field where Alternate on null was set to 0 with
both FieldChanged and FieldChanging events. The FieldChanged event code uses "If value <> 0" while the
FieldChanging event code is using "If value <> Ctyp..."
Set(ByVal value As System.Int32)
   Dim e As New TestBOFieldChangingEventArgs(TestBOFieldNames.ta_tst_idvalue)
   Dim llRaiseEvent As Boolean = False
   Dim loRow As DataRow = Me.CurrentRow
   Me.OnFieldPropertyChanging(Mee)
       value = CType(e.FieldValue, System.Int32)
       If value <> 0 Then
           If Not loRow.Item("ta_tst_id").Equals(valueThen llRaiseEvent = True
       Else
           If Not loRow.Item("ta_tst_id").Equals(DBNull.ValueThen llRaiseEvent = True
       End If
       If value <> CType(e.FieldValue, System.Int32Then
           loRow.Item("ta_tst_id") = value
       Else
          loRow.Item("ta_tst_id") = DBNull.Value
       End If
       If llRaiseEvent Then Me.OnFieldPropertyChanged(MeNew TestBOFieldChangedEventArgs(TestBOFieldNames.ta_tst_id))
End Set




GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search