public override ODataExpression VisitConstant(ODataConstantExpression expr) { if(expr.Value == null) { sqlBuilder.Append("NULL"); return expr; } Type type = expr.Value.GetType(); if (type == typeof(bool)) { this.sqlBuilder.Append((bool)expr.Value ? 1 : 0); } else if (type == typeof(long) || type == typeof(int) || type == typeof(short) || type == typeof(sbyte) || type == typeof(ulong) || type == typeof(uint) || type == typeof(ushort) || type == typeof(double) || type == typeof(float) || type == typeof(decimal)) { this.sqlBuilder.Append(expr.Value); } else { this.sqlBuilder.AppendFormat("'{0}'", expr.Value.ToString().Replace("'", "''")); } return expr; }
public virtual ODataExpression VisitConstant(ODataConstantExpression expr) { return this.Visit(expr); }