vb.net,llblgen 2.6,adapter mode
I am using the below function to build a PredicateExpression based on a string in the form "a,b,c,d"
Works fine but when the datatype is nullable then it fails.
eg data is of type guid eg "355184d1-69cd-4fdd-8887-f87662f03aee,355184d1-69cd-4fdd-8887-f87662f03aad"
oDataType.FullName = "System.Guid" when the datatype is guid but = "System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] " when it is nullable(of guid)
Is their a better method of detecting the datatype?
Private Function BuildBucket(ByVal oField As IEntityFieldCore, ByVal sIds As String, ByVal oDataType As System.Type) As PredicateExpression
Dim arIds As String()
Dim i As Int32
Dim bucket As New PredicateExpression
If Not sIds Is Nothing AndAlso sIds.Length > 0 Then
arIds = sIds.Split(",")
If oDataType.FullName = "System.Guid" Then
Dim groupsUIDs As Guid
For i = 0 To arIds.Length - 1
groupsUIDs = New Guid(arIds(i).ToString)
bucket.AddWithOr(New FieldCompareRangePredicate(oField, Nothing, groupsUIDs))
Next
End If
If oDataType.FullName = "System.String" Then
Dim arStrings As String = ""
If arIds.Length >= 1 Then
If arIds.Length <> 1 Then
For i = 0 To arIds.Length - 1
arStrings = arIds(i).ToString
bucket.AddWithOr(New FieldCompareRangePredicate(oField, Nothing, arStrings))
Next
Else
arStrings = arIds(0).ToString
bucket.AddWithOr(New FieldCompareValuePredicate(oField, Nothing, ComparisonOperator.Equal, arStrings))
End If
End If
End If
If oDataType.FullName = "System.Int32" Then
Dim arInt32s As Int32
For i = 0 To arIds.Length - 1
arInt32s = arIds(i).ToString
bucket.AddWithOr(New FieldCompareRangePredicate(oField, Nothing, arInt32s))
Next
End If
End If
Return bucket
End Function