CslaDataProvider and LinqBindingList

CslaDataProvider and LinqBindingList

Old forum URL: forums.lhotka.net/forums/t/7823.aspx


jjhartma posted on Monday, October 19, 2009

I'm having a problem figuring out how to use LinqBindingList with my CslaDataProvider.

I've got a ReadOnlyListBase class (Clients) that holds a collection of ClientInfo records.  The ClientInfo records so far contain only First Name, Middle Name, and Last Name.  In my XAML I have a CslaDataProvider for the Clients object that binds to a ComboBox.  What the user wants is to be able to type in the Combobox and have it filter the drop-down. What they really want is the filter to apply to each name as an 'or' so that "John" would show both John Smith and Bill Johnson.

I don't want the data provider to round-trip the database for each character the user types, so I'm thinking the LinqBindingList is the way to go.  Pull the data once and then filter it using Linq using what the user types.  Does anyone have an example or some guidance on how to do this?

JoeFallon1 replied on Tuesday, October 20, 2009

As I recall you do not get a LinqBindingList when using a Read Only Collection.

Therefore, just use regular LinqToObjects code for filtering and bind the IEnumerable result set.

Joe

 

Copyright (c) Marimer LLC