I have tried to implement filtered list as you have suggested in this post http://forums.lhotka.net/forums/thread/18628.aspx and described in the handbook for CSLA 2.1, filter does String contains (or sQL Like) when you use ApplyFilter ("property name", object as expression)
How can I achieve Equals instead of contains
For e.g.
I have read only collection, each object in the collection has following properties
SubCarrier_ID (int)
SubCarrier_Name (String)
Carrier_ID (int)
When I do applyfilter
Dim filtered as CSLA.FilteredBindingList(of SubCarrier)(SubCarrierList)
Filtered.ApplyFilter("CARRIER_ID", 1) ' Where 1 is the id of the Carrier
filtered now contains all the subcarriers with carrier__id including Carrier_ID 1, 10 ,100
I only want to filter objects with Carrier_ID = 1 (as you do in SQL WHERE Carrier_ID = 1)
Read about custom filter provider but looks like i am making it complicated (I am a beginner of CSLA and in .NET you can use Filter with DataView where it does WHERE)
No, you do need to create a custom filter for anything that the default filter doesn't do. The default filter calls Contains() (you can look at the code - it isn't complex).
You can do equals by creating a different filter like:
Public Shared Function Filter(ByVal item As Object, ByVal filterValue As Object) As BooleanHere is some sample code that may help when using FBL:
Protected
Function GetDataSource(ByVal key As Integer) As FilteredBindingList(Of MyBo)Joe
Copyright (c) Marimer LLC