internal override SqlExpression VisitClientParameter(SqlClientParameter cp)
 {
     if (cp.SqlType.CanBeParameter)
     {
         SqlParameter p = new SqlParameter(cp.ClrType, cp.SqlType, this.parameterizer.CreateParameterName(), cp.SourceExpression);
         this.currentParams.Add(new SqlParameterInfo(p, cp.Accessor.Compile()));
         return(p);
     }
     else
     {
         return(cp);
     }
 }
Exemple #2
0
 private void CoerceToFirst(SqlExpression arg1, ref SqlExpression arg2)
 {
     if (arg1.SqlType != null && arg2.SqlType != null)
     {
         if (arg2.NodeType == SqlNodeType.Value)
         {
             SqlValue val = (SqlValue)arg2;
             arg2 = sql.Value(
                 arg1.ClrType, arg1.SqlType,
                 DBConvert.ChangeType(val.Value, arg1.ClrType),
                 val.IsClientSpecified, arg2.SourceExpression
                 );
         }
         else if (arg2.NodeType == SqlNodeType.ClientParameter && arg2.SqlType != arg1.SqlType)
         {
             SqlClientParameter cp = (SqlClientParameter)arg2;
             cp.SetSqlType(arg1.SqlType);
         }
         else
         {
             arg2 = sql.UnaryConvert(arg1.ClrType, arg1.SqlType, arg2, arg2.SourceExpression);
         }
     }
 }
Exemple #3
0
 internal virtual SqlExpression VisitClientParameter(SqlClientParameter cp)
 {
     return(cp);
 }