Given your last statement above, your query should be:
session.Query<Item>.Where( i => i.Color == MyColor.For(255, 255, 255))
This should make NHibernate call your IUserType to convert the
parameter MyColor instance to whatever format is used in the database.
/Oskar
I've got no direct experience with the BuildHql() method, but there's
really only one thing this method needs to do:
1. traverse the incoming Expression
2. find all parts referencing a Color
3. collect this data to build (one or more) comparisons
4. pass this on to the treeBuilder
5. probably modify the expression to not contain the Color references
If the incoming queries have a fixed form, you can probably take many
shortcuts over parsing a generic query.
Methodically, I'd recommend getting the NHibernate source for the
release you're working on, and break into the BuildHql method with the
debugger of your choice and poke around in the interfaces and data
structures you're receiving.
Good Hunting, David