Developing on Staxmanade

i4o: Update (Index for Objects)

Recently I was added as a developer to the i4o codeplex project by Aaron and last night I made my first commit.

There were a few pretty big changes to the library. I'll highlight some of them below, and in a couple future posts will describe in a little more detail how you can use these features.

Removed the IndexableAttribute:

This was removed for two reasons.

  • It did not allow you index objects you didn't own.

Say you want to index a collection of System.IO.FileInfo objects. Since that's owned by the .Net framework, you can't apply an attribute to the properties of the class you want to index.

The solution to that was to allow adding indexed properties dynamically, however you had to give it a string representing the property name, which leads into the second issue...

  • Didn't provide any compile time checking or refactor support for properties using the dynamic add/remove methods.

If you refactored a property and forgot to rename the string to match the refactor you would end up with a runtime error.

To resolve the two issues above I've introduced the IndexSpecification<T> (I'll describe how to use it a later post)

Performance tuning:

Although we haven't enhanced the Linq support for IndexableCollection (should come soon), I was able to eek some performance by doing some internal caching of property types and a few other tweaks resulting in the Index creation becoming about 30% faster...

Fluent interface for managing the Indexes

The last big change which fits in with the IndexSpecification<T> is the Fluent interface for dynamically adding/removing properties to be indexed. One short example could be:

image

Comments