IndexableCollection

IndexableCollection

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


SouthSpawn posted on Saturday, June 21, 2008

Does anyone know if the CSLA 3.5 Framework comes with an "IndexableCollection" when it comes to list?
I saw a guy named "Aaron Erickson" speak on Friday, and he talked about this.

Thanks,
Mark

JonnyBee replied on Sunday, June 22, 2008

Hi,

Yes, CSLA 3.5 lists (BusinessListBase and ReadOnlyListBase) implements index for use in "LINQ to Objects" over CSLA lists.

/jonny

SouthSpawn replied on Sunday, June 22, 2008

Is there anything I have to do on my end to get the benefits of the index?

Any code examples of what I have to do if anything?

Thanks,
Mark

JoeFallon1 replied on Sunday, June 22, 2008

I do not recall any code samples of this being posted yet.

Rocky is in the midst of writing the book - I am sure it will be discussed there. But it won't be published til the Fall so...

Joe

RockfordLhotka replied on Monday, June 23, 2008

All you need to do is put the Indexable attribute on the child object property that should be indexed, everything else is automatic - the index will be built and used if needed.

Please note however, that building an index is not free. It is totally counter-productive to use indexing unless you are doing multiple queries against the same collection.

Also be aware that the current indexing scheme only supports equality operations. So it only helps if your where clause uses an equality check, and only if it just checks that one property.

Finally, be aware that once built, the index is automatically maintained. So if your collection changes frequently (new items, deleted items, edited items) that will cause the index to be rebuilt each time.

What this means is that indexed collections are best used for read only lists, where you load a large list and cache it so the data can be used many times over the life of the application. And it is only useful if you are doing single-property equality checks in your where clause.

Copyright (c) Marimer LLC