I just updated to the new version today, and discovered that one of the fixes completly broke my code. The fix I'm referring to is:
"Adapter: TypedList.GetRelationInfo() now returns a new RelationPredicateBucket object instead of an existing one. The old situation lead to errors when the GetRelationInfo() was used in a loop and a predicate was added to the PredicateExpression in the bucket. "
I'm sure it solved the above mentioned problem, but it another scenario it causes others. Let me explain.. I use the IRelationPredicateBucket as a property in many classes to reduce code redundancy as I may have a bunch of methods that tap into the same bucket/ common methods:
Private ReadOnly Property FilterBucket() As IRelationPredicateBucket
Get
Return NameValueList.GetRelationInfo
End Get
End Property
I might have one method that looks like this:
Public Function GetNameValueList(ByVal MaxNumRecords As Int32, _
ByVal SortFieldIndex As AvailableSortFields, _
ByVal SortType As Int32, _
ByVal AllowDuplicates As Boolean, _
ByVal FilterFieldIndex As FilterFieldsIndex, _
ByVal FilterCompareOperator As CompareOperator, _
ByVal FilterValue As Int32) As PropertyItemsNameValue
Dim SortExpression As ISortExpression = New SortExpression(SortClauseFactory.Create(CType(SortFieldIndex, PropertyItemFieldIndex), CType(SortType, SortOperator)))
Me.FilterBucket.PredicateExpression.Add(PredicateFactory.CompareValue(CType(FilterFieldIndex, PropertyItemFieldIndex), CType(FilterCompareOperator, ComparisonOperator), FilterValue))
Return FetchNameValueList(MaxNumRecords, SortExpression, AllowDuplicates)
End Function
I have other functions which are similar that also call the method 'FetchNameValueList':
Private Function FetchNameValueList(ByVal MaxNumRecords As Int32, _
ByVal sorter As ISortExpression, _
ByVal AllowDuplicates As Boolean) As PropertyItemsNameValue
Me.adapter.FetchTypedList(NameValueList.GetFieldsInfo, NameValueList, Me.FilterBucket, MaxNumRecords, sorter, AllowDuplicates)
Me.AddNameValues(Me.NameValueList, NameValuePairsIndex.NameColumnIndex, NameValuePairsIndex.ValueColumnIndex)
Return Me
End Function
The problem lies in using the property 'Me.FilterBucket', which (in the new version) created a NEW RelationPredicateBucket object which in turn blows away the PredicateExpression I need that I added in the 'GetNameValueList' method.
Since I'm 4 months into the project, plus another project I'm working on taps into this project's business objects, I need to come up with some sort of work around to avoid a new RelationPredicateBucket object being created everytime the FilterBucket property is called.
Otherwise, I'll be stuck with the older version since the projects are too far along to go in and redo the code everywhere...
sigh... I guess one man's fix is another man's curse..
Steve