/// <summary> /// Get the expression type. /// </summary> /// <param name="exp">The expression to return.</param> /// <returns>The expression type.</returns> public static ExpressionType GetExpressionType(Nequeo.Linq.ExpressionOperandType exp) { switch (exp) { case Nequeo.Linq.ExpressionOperandType.Add: return(ExpressionType.Add); case Nequeo.Linq.ExpressionOperandType.Divide: return(ExpressionType.Divide); case Nequeo.Linq.ExpressionOperandType.Equal: return(ExpressionType.Equal); case Nequeo.Linq.ExpressionOperandType.GreaterThan: return(ExpressionType.GreaterThan); case Nequeo.Linq.ExpressionOperandType.GreaterThanOrEqual: return(ExpressionType.GreaterThanOrEqual); case Nequeo.Linq.ExpressionOperandType.IsFalse: return(ExpressionType.IsFalse); case Nequeo.Linq.ExpressionOperandType.IsTrue: return(ExpressionType.IsTrue); case Nequeo.Linq.ExpressionOperandType.LessThan: return(ExpressionType.LessThan); case Nequeo.Linq.ExpressionOperandType.LessThanOrEqual: return(ExpressionType.LessThanOrEqual); case Nequeo.Linq.ExpressionOperandType.Multiply: return(ExpressionType.Multiply); case Nequeo.Linq.ExpressionOperandType.NotEqual: return(ExpressionType.NotEqual); case Nequeo.Linq.ExpressionOperandType.Subtract: return(ExpressionType.Subtract); case Nequeo.Linq.ExpressionOperandType.And: return(ExpressionType.And); case Nequeo.Linq.ExpressionOperandType.Or: return(ExpressionType.Or); case Nequeo.Linq.ExpressionOperandType.AndAlso: return(ExpressionType.AndAlso); case Nequeo.Linq.ExpressionOperandType.OrElse: return(ExpressionType.OrElse); default: throw new Exception(string.Format("Unhandled expression type: '{0}'", exp.ToString())); } }
/// <summary> /// Get the expression operand string. /// </summary> /// <param name="exp">The expression to return.</param> /// <returns>The string expression.</returns> public static string GetExpression(Nequeo.Linq.ExpressionOperandType exp) { switch (exp) { case Nequeo.Linq.ExpressionOperandType.Add: return("+"); case Nequeo.Linq.ExpressionOperandType.Between: return("Between"); case Nequeo.Linq.ExpressionOperandType.Divide: return("/"); case Nequeo.Linq.ExpressionOperandType.Equal: return("=="); case Nequeo.Linq.ExpressionOperandType.GreaterThan: return(">"); case Nequeo.Linq.ExpressionOperandType.GreaterThanOrEqual: return(">="); case Nequeo.Linq.ExpressionOperandType.In: return("In"); case Nequeo.Linq.ExpressionOperandType.IsFalse: return("false"); case Nequeo.Linq.ExpressionOperandType.IsNotNull: return("IsNotNull"); case Nequeo.Linq.ExpressionOperandType.IsNull: return("IsNull"); case Nequeo.Linq.ExpressionOperandType.IsTrue: return("true"); case Nequeo.Linq.ExpressionOperandType.LessThan: return("<"); case Nequeo.Linq.ExpressionOperandType.LessThanOrEqual: return("<="); case Nequeo.Linq.ExpressionOperandType.Like: return("Like"); case Nequeo.Linq.ExpressionOperandType.LikeEscape: return("LikeEscape"); case Nequeo.Linq.ExpressionOperandType.Multiply: return("*"); case Nequeo.Linq.ExpressionOperandType.NotBetween: return("NotBetween"); case Nequeo.Linq.ExpressionOperandType.NotEqual: return("!="); case Nequeo.Linq.ExpressionOperandType.NotIn: return("NotIn"); case Nequeo.Linq.ExpressionOperandType.NotLike: return("NotLike"); case Nequeo.Linq.ExpressionOperandType.NotLikeEscape: return("NotLikeEscape"); case Nequeo.Linq.ExpressionOperandType.Subtract: return("-"); case Nequeo.Linq.ExpressionOperandType.And: return("&"); case Nequeo.Linq.ExpressionOperandType.Or: return("|"); case Nequeo.Linq.ExpressionOperandType.AndAlso: return("&&"); case Nequeo.Linq.ExpressionOperandType.OrElse: return("||"); default: return(""); } }
/// <summary> /// Get the sql expression operand string. /// </summary> /// <param name="exp">The expression to return.</param> /// <returns>The string expression.</returns> public static string GetSqlExpression(Nequeo.Linq.ExpressionOperandType exp) { switch (exp) { case Nequeo.Linq.ExpressionOperandType.Add: return("+"); case Nequeo.Linq.ExpressionOperandType.Between: return("BETWEEN"); case Nequeo.Linq.ExpressionOperandType.Divide: return("/"); case Nequeo.Linq.ExpressionOperandType.Equal: return("="); case Nequeo.Linq.ExpressionOperandType.GreaterThan: return(">"); case Nequeo.Linq.ExpressionOperandType.GreaterThanOrEqual: return(">="); case Nequeo.Linq.ExpressionOperandType.In: return("IN"); case Nequeo.Linq.ExpressionOperandType.IsFalse: return("FALSE"); case Nequeo.Linq.ExpressionOperandType.IsNotNull: return("IS NOT NULL"); case Nequeo.Linq.ExpressionOperandType.IsNull: return("IS NULL"); case Nequeo.Linq.ExpressionOperandType.IsTrue: return("TRUE"); case Nequeo.Linq.ExpressionOperandType.LessThan: return("<"); case Nequeo.Linq.ExpressionOperandType.LessThanOrEqual: return("<="); case Nequeo.Linq.ExpressionOperandType.Like: return("LIKE"); case Nequeo.Linq.ExpressionOperandType.LikeEscape: return("LIKE ESCAPE"); case Nequeo.Linq.ExpressionOperandType.Multiply: return("*"); case Nequeo.Linq.ExpressionOperandType.NotBetween: return("NOT BETWEEN"); case Nequeo.Linq.ExpressionOperandType.NotEqual: return("<>"); case Nequeo.Linq.ExpressionOperandType.NotIn: return("NOT IN"); case Nequeo.Linq.ExpressionOperandType.NotLike: return("NOT LIKE"); case Nequeo.Linq.ExpressionOperandType.NotLikeEscape: return("NOT LIKE ESCAPE"); case Nequeo.Linq.ExpressionOperandType.Subtract: return("-"); case Nequeo.Linq.ExpressionOperandType.And: return("AND"); case Nequeo.Linq.ExpressionOperandType.Or: return("OR"); case Nequeo.Linq.ExpressionOperandType.AndAlso: return("AND"); case Nequeo.Linq.ExpressionOperandType.OrElse: return("OR"); default: return(""); } }