protected Pair <SqlExpression, IEnumerable <QueryParameterBinding> > ProcessExpression(LambdaExpression le,
                                                                                               params IReadOnlyList <SqlExpression>[] sourceColumns)
        {
            var processor = new ExpressionProcessor(le, Handlers, this, sourceColumns);
            var result    = new Pair <SqlExpression, IEnumerable <QueryParameterBinding> >(
                processor.Translate(), processor.GetBindings());

            return(result);
        }
Пример #2
0
        public string Compile(HandlerAccessor handlers, IndexInfo index)
        {
            var table = SqlDml.TableRef(CreateStubTable(index.ReflectedType.MappingName, index.Filter.Fields.Count));
            // Translation of ColumnRefs without alias seems broken, use original name as alias.
            var columns = index.Filter.Fields
                          .Select(field => field.Column.Name)
                          .Select((name, i) => SqlDml.ColumnRef(table.Columns[i], name))
                          .Cast <SqlExpression>()
                          .ToList();

            var processor = new ExpressionProcessor(index.Filter.Expression, handlers, null, columns);
            var fragment  = SqlDml.Fragment(processor.Translate());
            var result    = handlers.StorageDriver.Compile(fragment).GetCommandText();

            return(result);
        }