Esempio n. 1
0
        public TopClause(int rowCountLimit, ICommandParameterFactory commandParameterFactory)
        {
            _rowCountLimit = rowCountLimit;

            var parameter = commandParameterFactory.Create("RowCountLimit", _rowCountLimit);

            CommandParameters.Add(parameter);
        }
Esempio n. 2
0
        public TopClause(int rowCountLimit, ICommandParameterFactory commandParameterFactory)
        {
            _rowCountLimit = rowCountLimit;

            var parameter = commandParameterFactory.Create("RowCountLimit", _rowCountLimit);

            CommandParameters.Add(parameter);
        }
Esempio n. 3
0
            public void Visit(InExpression expression)
            {
                if (expression.ArrayValueExpression.Values.IsEmpty())
                {
                    throw new WeenyMapperException("Can not generate IN constraint from empty collection");
                }

                var columnName = expression.PropertyExpression.PropertyName;

                var newParameters = new List <CommandParameter>();

                foreach (var value in expression.ArrayValueExpression.Values)
                {
                    var commandParameter = _commandParameterFactory.Create(columnName, value);
                    CommandParameters.Add(commandParameter);
                    newParameters.Add(commandParameter);
                }
                var parameterString  = string.Join(", ", newParameters.Select(x => x.ReferenceName));
                var columnNameString = CreateColumnNameString(expression.PropertyExpression.PropertyName);

                ConstraintCommandText = string.Format("({0} IN ({1}))", columnNameString, parameterString);
            }