Hi Andrei,

Thanks for the example however that wouldnt be a very efficient query.
Basically you are making a subtraction then use the equality. For a
simple comparison query that would generate an inefficient query.

On Jun 10, 3:14 pm, Andrei <[email protected]> wrote:
> Checkhttp://fabiomaulo.blogspot.com/2010/07/nhibernate-linq-provider-exten...
> .
> You can extend the Linq Provider to translate the class to
> String.Compare in a HqlNode.
> Here is a similar class for Int32.Compare:
>
>         public class Int32LinqGenerator : BaseHqlGeneratorForMethod
>         {
>                 public Int32LinqGenerator()
>                 {
>                         SupportedMethods = new[]
> { ReflectionHelper.GetMethodDefinition<Int32>(x =>
> x.CompareTo(Int32.MinValue)) };
>                 }
>
>                 public override NHibernate.Hql.Ast.HqlTreeNode
> BuildHql(System.Reflection.MethodInfo method,
>                         System.Linq.Expressions.Expression targetObject,
>
> System.Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.Expression>
> arguments,
>                         NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder,
>                         NHibernate.Linq.Visitors.IHqlExpressionVisitor 
> visitor)
>                 {
>                         HqlExpression nodeTarget =
> visitor.Visit(targetObject).AsExpression();
>                         return treeBuilder.Subtract(
>                                 nodeTarget,
>                                 visitor.Visit(arguments[0]).AsExpression()
>                                 );
>                 }
>         }
>
> Andrei
>
> On Jun 10, 12:54 pm, mynkow <[email protected]> wrote:
>
>
>
>
>
>
>
> > you cannot do this. I also want to use string.Compare() but it is not
> > possible for now.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to