protected override SqlExpression VisitUnary(UnaryExpression expression) { var operand = Visit(expression.Operand); if (expression.Method != null) { return(CompileMember(expression.Method, null, operand)); } switch (expression.NodeType) { case ExpressionType.ArrayLength: if (expression.Operand.Type != typeof(byte[])) { throw new NotSupportedException(string.Format(Strings.ExTypeXIsNotSupported, expression.Operand.Type)); } return(SqlDml.Cast(SqlDml.BinaryLength(operand), driver.MapValueType(typeof(int)))); case ExpressionType.Negate: case ExpressionType.NegateChecked: return(SqlDml.Negate(operand)); case ExpressionType.UnaryPlus: return(operand); case ExpressionType.Not: return(IsBooleanExpression(expression.Operand) ? SqlDml.Not(operand) : SqlDml.BitNot(operand)); case ExpressionType.Convert: case ExpressionType.ConvertChecked: return(VisitCast(expression, operand)); } return(operand); }
public static SqlExpression ByteArrayLength(SqlExpression _this) { return(SqlDml.BinaryLength(_this)); }