コード例 #1
0
 ///// <summary>
 ///// If a type is nullable of we must
 ///// </summary>
 ///// <param name="type"></param>
 ///// <returns></returns>
 //private System.Type GetTypeCheckForNullable(System.Type type) {
 //if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) {…}
 //w.FinalType.GetGenericArguments()
 //}
 /// <summary>
 /// Ok we have a sql function, the inner token already created a criterion we
 /// only needs to configureIt
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 private WalkedToken WalkSqlFunction(WalkedToken left, WalkedToken right)
 {
     CustomCriterion.SqlFunctionCriterion crit = (CustomCriterion.SqlFunctionCriterion)left.Criterion;
     //configureSqlCustomCriterion(crit);
     NHibernate.Expressions.ICriterion outCriterion = expCreator("", null);
     crit.StrOperator = outCriterion.GetType().GetProperty(
         "Op", BindingFlags.NonPublic | BindingFlags.Instance)
                        .GetValue(outCriterion, null) as String;
     crit.ValueToCompareTo = right.GetValue <Object>();
     return(left);
 }
コード例 #2
0
        /// <summary>
        /// We need to pop from the stack all the parameters of the function to call.
        /// </summary>
        /// <param name="queue"></param>
        /// <returns></returns>
        internal override WalkedToken Walk(Stack<WalkedToken> stack)
        {
            //The parameter to pass to sql function except the first that is the method name
            Object[] invokeArguments = new Object[mParameterNum - 1];
            Int32 propertyParameterIndex = 0;
            for (Int32 pi = invokeArguments.Length - 1; pi >= 0; --pi)
            {
                WalkedToken wt = stack.Pop();
                invokeArguments[pi] = wt.GetValue<Object>();
                if (wt.TokenType == TokenType.PropertyPath)
                    propertyParameterIndex = pi;

            }
            stack.Pop(); //Remove the last element that does not means nothing.
            CustomCriterion.SqlFunctionCriterion crit =
                new CustomCriterion.SqlFunctionCriterion(
                    propertyParameterIndex, null, null, mSqlFunction, invokeArguments);
            return WalkedToken.FromSqlCriterion(crit);
        }
コード例 #3
0
        /// <summary>
        /// We need to pop from the stack all the parameters of the function to call.
        /// </summary>
        /// <param name="queue"></param>
        /// <returns></returns>
        internal override WalkedToken Walk(Stack <WalkedToken> stack)
        {
            //The parameter to pass to sql function except the first that is the method name
            Object[] invokeArguments        = new Object[mParameterNum - 1];
            Int32    propertyParameterIndex = 0;

            for (Int32 pi = invokeArguments.Length - 1; pi >= 0; --pi)
            {
                WalkedToken wt = stack.Pop();
                invokeArguments[pi] = wt.GetValue <Object>();
                if (wt.TokenType == TokenType.PropertyPath)
                {
                    propertyParameterIndex = pi;
                }
            }
            stack.Pop(); //Remove the last element that does not means nothing.
            CustomCriterion.SqlFunctionCriterion crit =
                new CustomCriterion.SqlFunctionCriterion(
                    propertyParameterIndex, null, null, mSqlFunction, invokeArguments);
            return(WalkedToken.FromSqlCriterion(crit));
        }
コード例 #4
0
        public static WalkedToken FromSqlCriterion(CustomCriterion.SqlFunctionCriterion criterion)
        {
            WalkedToken token = new WalkedToken(TokenType.SqlFunction, criterion, null);

            return(token);
        }