UnwrapPrimaryKey() public static method

public static UnwrapPrimaryKey ( Expression unary ) : Expression
unary System.Linq.Expressions.Expression
return System.Linq.Expressions.Expression
Exemplo n.º 1
0
        public static Expression InPrimaryKey(Expression element, PrimaryKey[] values)
        {
            var cleanValues = values.Select(a => a.Object).ToArray();

            var cleanElement = SmartEqualizer.UnwrapPrimaryKey(element);

            if (cleanElement == NewId)
            {
                return(False);
            }

            return(InExpression.FromValues(DbExpressionNominator.FullNominate(cleanElement), cleanValues));
        }
Exemplo n.º 2
0
        public static Expression InPrimaryKey(Expression element, PrimaryKey[] values)
        {
            var cleanValues = values.Select(a => a.Object).ToArray();

            var cleanElement = SmartEqualizer.UnwrapPrimaryKey(element);

            if (cleanElement == NewId)
            {
                return(False);
            }

            cleanElement = DbExpressionNominator.FullNominate(cleanElement) !;

            if (cleanElement.Type == typeof(string))
            {
                return(InExpression.FromValues(cleanElement, cleanValues.Select(a => (object)a.ToString() !).ToArray()));
            }
            else
            {
                return(InExpression.FromValues(cleanElement, cleanValues));
            }
        }