Example #1
0
        private Expression CreateComparsion(Expression x, Expression y, SortOrder ordering)
        {
            MethodInfo compareMethod =
                ReflectionHelper.GetStaticMethodInfo(() =>
                                                     PrimitiveKeyComparer.Compare <object>(null, null, SortOrder.Ascending));

            compareMethod = compareMethod
                            .GetGenericMethodDefinition()
                            .MakeGenericMethod(x.Type);

            return(Expression.Call(
                       compareMethod,
                       x,
                       y,
                       Expression.Constant(ordering, typeof(SortOrder))));
        }
 public int Compare(T x, T y)
 {
     return(PrimitiveKeyComparer.Compare <T>(x, y, this.sortOrder));
 }