Skip to content

Commit

Permalink
Corrected MySQL boolean fields with used with FieldMappingAttribute. C…
Browse files Browse the repository at this point in the history
…loses #60.

This only seems to affect the MySql.Data.MySqlClient.MySqlConnection not the OLEDB connection provider.
  • Loading branch information
hisystems committed May 6, 2012
1 parent 606727d commit d68175a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Database/DatabaseObjectUsingAttributesHelper.vb
Expand Up @@ -290,6 +290,9 @@ Public Module DatabaseObjectUsingAttributesHelper
'Set the distinct value if this is an ObjectReference field
ElseIf TypeOf objField.GetValue(objObject) Is ObjectReference Then
DirectCast(objField.GetValue(objObject), ObjectReference).DistinctValue = objFields(objFieldMapping.FieldName).Value
ElseIf objField.FieldType.Equals(GetType(Boolean)) AndAlso Not objFields(objFieldMapping.FieldName).Value.GetType.Equals(GetType(Boolean)) Then
'MySQL connection provides BIT data as a ULong data type, so convert to boolean.
objField.SetValue(objObject, CInt(objFields(objFieldMapping.FieldName).Value) <> 0)
Else
objField.SetValue(objObject, objFields(objFieldMapping.FieldName).Value)
End If
Expand All @@ -316,6 +319,9 @@ Public Module DatabaseObjectUsingAttributesHelper
System.Enum.ToObject(objProperty.PropertyType, _
objFields(objFieldMapping.FieldName).Value), _
Nothing)
ElseIf objProperty.PropertyType.Equals(GetType(Boolean)) AndAlso Not objFields(objFieldMapping.FieldName).Value.GetType.Equals(GetType(Boolean)) Then
'MySQL connection provides BIT data as a ULong data type, so convert to boolean.
objProperty.SetValue(objObject, CInt(objFields(objFieldMapping.FieldName).Value) <> 0, Nothing)
Else
objProperty.SetValue(objObject, objFields(objFieldMapping.FieldName).Value, Nothing)
End If
Expand Down

0 comments on commit d68175a

Please sign in to comment.