Extending LINQ to Nhibernate provider, in combination with Dynamic LINQ problem

前端 未结 3 1960
春和景丽
春和景丽 2021-01-02 21:28

I\'m using NHibernate 3.1.0 and I\'m trying to extend the LINQ provider by using BaseHqlGeneratorForMethod and extending the DefaultLinqToHqlGeneratorsReg

3条回答
  •  迷失自我
    2021-01-02 22:07

    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());
        }
    }
    

提交回复
热议问题