I\'m using NHibernate 3.1.0 and I\'m trying to extend the LINQ provider by using BaseHqlGeneratorForMethod
and extending the DefaultLinqToHqlGeneratorsReg
I had the same problem and fixed it.
At first I want to thank murki for providing the information which got me on my way!
The answer lies partly in Fabio's post. To solve this issue you have to use the RegisterGenerator
instead of the Merge
method in the CustomLinqToHqlGeneratorsRegistry
constructor. My implementation of the CustomLinqToHqlGeneratorsRegistry
class is as follows:
public class CustomLinqToHqlGeneratorsRegistry : DefaultLinqToHqlGeneratorsRegistry
{
public CustomLinqToHqlGeneratorsRegistry()
: base()
{
MethodInfo toStringMethod = ReflectionHelper.GetMethodDefinition(x => x.ToString());
RegisterGenerator(toStringMethod, new ToStringGenerator());
}
}