Exemplo n.º 1
0
            public string ToJsonBuildObjectPair(IQueryableDocument mapping)
            {
                var field   = mapping.FieldFor(Field.ToArray());
                var locator = field.SelectionLocator ?? field.SqlLocator;

                return($"'{Name}', {locator}");
            }
Exemplo n.º 2
0
        public ISelector <T> ToSelector <T>(IDocumentSchema schema, IQueryableDocument mapping)
        {
            if (_selectionType == SelectionType.AsJson && _target == null)
            {
                return(new JsonSelector().As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.AsJson && _target != null)
            {
                return(_target.ToJsonSelector <T>(mapping));
            }


            if (_selectionType == SelectionType.TransformToJson)
            {
                var transform = schema.TransformFor(_transformName);
                return(new TransformToJsonSelector(transform, mapping).As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.TransformTo)
            {
                var transform = schema.TransformFor(_transformName);

                return(new TransformToTypeSelector <T>(transform, mapping));
            }

            if (_target == null || _target.Type != typeof(T))
            {
                return(new SingleFieldSelector <T>(mapping, _currentField.Members.Reverse().ToArray()));
            }

            return(_target.ToSelector <T>(mapping));
        }
Exemplo n.º 3
0
        private IWhereFragment buildSimpleWhereClause(IQueryableDocument mapping, BinaryExpression binary)
        {
            var isValueExpressionOnRight = binary.Right.IsValueExpression();

            var isSubQuery = isValueExpressionOnRight
                ? binary.Left is SubQueryExpression
                : binary.Right is SubQueryExpression;

            if (isSubQuery)
            {
                var jsonLocatorExpression = isValueExpressionOnRight ? binary.Left : binary.Right;
                var valueExpression       = isValueExpressionOnRight ? binary.Right : binary.Left;

                var op = _operators[binary.NodeType];

                return(buildChildCollectionQuery(mapping, jsonLocatorExpression.As <SubQueryExpression>().QueryModel, valueExpression, op));
            }

            var parser = _supplementalParsers.OfType <IExpressionParser <BinaryExpression> >()?.FirstOrDefault(x => x.Matches(binary));

            if (parser != null)
            {
                var where = parser.Parse(mapping, _serializer, binary);

                return(where);
            }

            throw new NotSupportedException("Marten does not yet support this type of Linq query");
        }
Exemplo n.º 4
0
        public static ISelector <T> BuildSelector <T>(this IDocumentSchema schema, IQueryableDocument mapping, QueryModel query)
        {
            var selectable = query.AllResultOperators().OfType <ISelectableOperator>().FirstOrDefault();

            if (selectable != null)
            {
                return(selectable.BuildSelector <T>(schema, mapping));
            }

            if (query.SelectClause.Selector.Type == query.SourceType())
            {
                if (typeof(T) == typeof(string))
                {
                    return((ISelector <T>) new JsonSelector());
                }

                // I'm so ashamed of this hack, but "simplest thing that works"
                if (typeof(T) == typeof(IEvent))
                {
                    return(mapping.As <EventQueryMapping>().Selector.As <ISelector <T> >());
                }

                var resolver = schema.ResolverFor <T>();
                return(new WholeDocumentSelector <T>(mapping, resolver));
            }


            var visitor = new SelectorParser(query);

            visitor.Visit(query.SelectClause.Selector);

            return(visitor.ToSelector <T>(schema, mapping));
        }
Exemplo n.º 5
0
        public SelectManyQuery(IDocumentSchema schema, IQueryableDocument mapping, QueryModel query, int index)
        {
            Index = index;

            _schema = schema;
            _query  = query;

            _from = query.BodyClauses[index - 1].As <AdditionalFromClause>();

            var members = FindMembers.Determine(_from.FromExpression);

            _field = mapping.FieldFor(members);

            IsDistinct = query.HasOperator <DistinctResultOperator>();

            var next = query.BodyClauses.Skip(index + 1).FirstOrDefault(x => x is AdditionalFromClause);

            if (next != null)
            {
                throw new NotSupportedException("Not yet supporting SelectMany().SelectMany()");
            }
            else
            {
                _take = _query.BodyClauses.Count - index;
            }


            _tableAlias   = "sub" + Index;
            _documentType = _field.MemberType.DeriveElementType();
            _document     = _schema.StoreOptions.GetChildDocument(_tableAlias + ".x", _documentType);
        }
Exemplo n.º 6
0
        public LinqQuery(DocumentStore store, QueryModel model, IIncludeJoin[] joins, QueryStatistics stats)
        {
            Model  = model;
            _store = store;
            _joins = joins;

            // TODO -- going to have to push in the ITenant eventually
            _mapping = store.Tenancy.Default.MappingFor(model.SourceType()).ToQueryableDocument();

            for (var i = 0; i < model.BodyClauses.Count; i++)
            {
                var clause = model.BodyClauses[i];
                if (clause is AdditionalFromClause)
                {
                    // TODO -- to be able to go recursive, have _subQuery start to read the BodyClauses
                    _subQuery = new SelectManyQuery(store, _mapping, model, i + 1);


                    break;
                }
            }

            Selector   = BuildSelector(joins, stats, _subQuery, joins);
            SourceType = Model.SourceType();

            Where = buildWhereFragment();
        }
Exemplo n.º 7
0
        public LinqQuery(IDocumentSchema schema, QueryModel model, IIncludeJoin[] joins, QueryStatistics stats)
        {
            Model    = model;
            _schema  = schema;
            _joins   = joins;
            _mapping = schema.MappingFor(model.SourceType()).ToQueryableDocument();

            for (var i = 0; i < model.BodyClauses.Count; i++)
            {
                var clause = model.BodyClauses[i];
                if (clause is AdditionalFromClause)
                {
                    // TODO -- to be able to go recursive, have _subQuery start to read the BodyClauses
                    _subQuery = new SelectManyQuery(schema, _mapping, model, i + 1);


                    break;
                }
            }

            Selector   = BuildSelector(joins, stats, _subQuery, joins);
            SourceType = Model.SourceType();

            Where = buildWhereFragment();
        }
Exemplo n.º 8
0
        public static string[] ToSelectFields(string tableAlias, IQueryableDocument includedMapping, ISelector <TSearched> inner)
        {
            var innerFields = inner.SelectFields();
            var outerFields = includedMapping.SelectFields().Select(x => $"{tableAlias}.{x}");

            return(innerFields.Concat(outerFields).ToArray());
        }
Exemplo n.º 9
0
        public ISelector <T> ToSelector <T>(string dataLocator, ITenant tenant, IQueryableDocument mapping)
        {
            if (_selectionType == SelectionType.AsJson && _target == null)
            {
                return(new JsonSelector().As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.AsJson && _target != null)
            {
                return(_target.ToJsonSelector <T>(mapping));
            }

            if (_selectionType == SelectionType.TransformToJson)
            {
                var transform = tenant.TransformFor(_transformName);
                return(new TransformToJsonSelector(dataLocator, transform, mapping).As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.TransformTo)
            {
                var transform = tenant.TransformFor(_transformName);

                return(new TransformToTypeSelector <T>(dataLocator, transform, mapping));
            }

            if (_target == null || _target.Type != typeof(T))
            {
                return(new SingleFieldSelector <T>(mapping, _currentField.ToArray(), _distinct));
            }

            return(_target.ToSelector <T>(mapping, _distinct));
        }
Exemplo n.º 10
0
        public void AppendJoin(CommandBuilder sql, string rootTableAlias, IQueryableDocument document)
        {
            var locator = document == null
                ? _field.LocatorFor(rootTableAlias)
                : document.FieldFor(_field.Members).LocatorFor(rootTableAlias);

            var joinOperator = JoinType == JoinType.Inner ? InnerJoin : OuterJoin;

            sql.Append(joinOperator);
            sql.Append(" ");

            if (IsSoftDeleted)
            {
                sql.Append("(select * from ");
                sql.Append(_mapping.Table.QualifiedName);
                sql.Append(" where ");
                sql.Append(DocumentMapping.DeletedColumn);
                sql.Append(" = False)");
            }
            else
            {
                sql.Append(_mapping.Table.QualifiedName);
            }

            sql.Append(" as ");
            sql.Append(TableAlias);
            sql.Append(" ON ");
            sql.Append(locator);
            sql.Append(" = ");
            sql.Append(TableAlias);
            sql.Append(".id");
        }
Exemplo n.º 11
0
        public string ToJsonBuildObjectPair(IQueryableDocument mapping)
        {
            var locator = mapping.FieldFor(Field.Members).SelectionLocator;


            return($"'{Setter.Name}', {locator}");
        }
Exemplo n.º 12
0
 public PatchOperation(TransformFunction transform, IQueryableDocument document, IWhereFragment fragment,
     IDictionary<string, object> patch)
 {
     _transform = transform;
     _document = document;
     _fragment = fragment;
     _patch = patch;
 }
Exemplo n.º 13
0
        // Polyfill for the Async Daemon where it doesn't do any harm
        public static string ToSelectClause(this ISelector selector, IQueryableDocument mapping)
        {
            var builder = new CommandBuilder(new NpgsqlCommand());

            selector.WriteSelectClause(builder, mapping);

            return(builder.ToString());
        }
Exemplo n.º 14
0
 public PatchOperation(TransformFunction transform, IQueryableDocument document, IWhereFragment fragment,
                       IDictionary <string, object> patch)
 {
     _transform = transform;
     _document  = document;
     _fragment  = fragment;
     _patch     = patch;
 }
Exemplo n.º 15
0
 public ChildCollectionWhereVisitor(ISerializer serializer, SubQueryExpression expression, Action <IWhereFragment> registerFilter, IQueryableDocument mapping)
 {
     _serializer     = serializer;
     _expression     = expression;
     _query          = expression.QueryModel;
     _registerFilter = registerFilter;
     _mapping        = mapping;
 }
Exemplo n.º 16
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var members = FindMembers.Determine(expression);

            var field = mapping.FieldFor(members);

            return(new WhereFragment($"({field.SelectionLocator} is null or jsonb_array_length({field.SelectionLocator}) = 0)"));
        }
Exemplo n.º 17
0
 public void WriteSelectClause(CommandBuilder sql, IQueryableDocument mapping)
 {
     sql.Append("select ");
     sql.Append(_fieldName);
     sql.Append(" from ");
     sql.Append(_document.Table.QualifiedName);
     sql.Append(" as d");
 }
Exemplo n.º 18
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var members = FindMembers.Determine(expression);

            var field = mapping.FieldFor(members);

            return new WhereFragment($"({field.SelectionLocator} is null or jsonb_array_length({field.SelectionLocator}) = 0)");
        }
Exemplo n.º 19
0
        public static string ToOrderClause(this Ordering clause, IQueryableDocument mapping)
        {
            var locator = mapping.JsonLocator(clause.Expression);

            return(clause.OrderingDirection == OrderingDirection.Asc
                ? locator
                : locator + " desc");
        }
Exemplo n.º 20
0
        public IncludeJoin(IQueryableDocument mapping, string joinText, string tableAlias, Action <T> callback)
        {
            JoinText  = joinText;
            _mapping  = mapping;
            _callback = callback;

            TableAlias = tableAlias;
        }
Exemplo n.º 21
0
 public PatchOperation(TransformFunction transform, IQueryableDocument document, ISqlFragment fragment,
                       IDictionary <string, object> patch, ISerializer serializer)
 {
     _transform  = transform;
     _document   = document;
     _fragment   = fragment;
     _patch      = patch;
     _serializer = serializer;
 }
Exemplo n.º 22
0
        public IncludeSelector(string tableAlias, IQueryableDocument includedMapping, Action <TIncluded> callback, ISelector <TSearched> inner, IDocumentStorage <TIncluded> documentStorage)
            : base(ToSelectFields(tableAlias, includedMapping, inner))
        {
            _callback = callback;
            _inner    = inner;
            storage   = documentStorage;

            StartingIndex = _inner.SelectFields().Length;
        }
Exemplo n.º 23
0
        public IncludeJoin(IQueryableDocument mapping, IField field, string tableAlias, Action <T> callback, JoinType joinType)
        {
            _mapping  = mapping;
            _field    = field;
            _callback = callback;

            TableAlias = tableAlias;
            JoinType   = joinType;
        }
Exemplo n.º 24
0
        private static IList <IDbParameterSetter> findSetters(IQueryableDocument mapping, Type queryType, Expression expression, EnumStorage enumStorage)
        {
            var visitor = new CompiledQueryMemberExpressionVisitor(mapping, queryType, enumStorage);

            visitor.Visit(expression);
            var parameterSetters = visitor.ParameterSetters;

            return(parameterSetters);
        }
Exemplo n.º 25
0
        public IncludeSelector(string tableAlias, IQueryableDocument includedMapping, Action <TIncluded> callback, ISelector <TSearched> inner, IResolver <TIncluded> resolver)
            : base(ToSelectFields(tableAlias, includedMapping, inner))
        {
            _callback = callback;
            _inner    = inner;
            _resolver = resolver;

            StartingIndex = _inner.SelectFields().Length;
        }
Exemplo n.º 26
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, BinaryExpression expression)
        {
            var isValueExpressionOnRight = expression.Right.IsValueExpression();
            var jsonLocatorExpression    = isValueExpressionOnRight ? expression.Left : expression.Right;
            var valueExpression          = isValueExpressionOnRight ? expression.Right : expression.Left;

            var members = FindMembers.Determine(jsonLocatorExpression);

            var field = mapping.FieldFor(members);


            var value       = field.GetValue(valueExpression);
            var jsonLocator = field.SqlLocator;

            var useContainment = mapping.PropertySearching == PropertySearching.ContainmentOperator || field.ShouldUseContainmentOperator();

            var isDuplicated = (mapping.FieldFor(members) is DuplicatedField);

            if (useContainment &&
                expression.NodeType == ExpressionType.Equal && value != null && !isDuplicated)
            {
                return(new ContainmentWhereFragment(serializer, expression, _wherePrefix));
            }


            if (value == null)
            {
                var sql = expression.NodeType == ExpressionType.NotEqual
                    ? $"({jsonLocator}) is not null"
                    : $"({jsonLocator}) {_isOperator} null";

                return(new WhereFragment(sql));
            }

            var op = _operators[expression.NodeType];

            if (jsonLocatorExpression.NodeType == ExpressionType.Modulo)
            {
                var byValue      = moduloByValue((isValueExpressionOnRight ? expression.Left : expression.Right) as BinaryExpression);
                var moduloFormat = isValueExpressionOnRight ? "{0} % {1} {2} ?" : "? {2} {0} % {1}";
                return(new WhereFragment(moduloFormat.ToFormat(jsonLocator, byValue, op), value));
            }

            // ! == -> <>

            if (expression.Left.NodeType == ExpressionType.Not && expression.NodeType == ExpressionType.Equal)
            {
                op = _operators[ExpressionType.NotEqual];
            }

            var whereFormat = isValueExpressionOnRight ? "{0} {1} ?" : "? {1} {0}";

            return(new WhereFragment($"{_wherePrefix}{whereFormat.ToFormat(jsonLocator, op)}", value));


            return(value == null ? new WhereFragment($"({jsonLocator}) {_isOperator} null") : new WhereFragment($"{_wherePrefix}({jsonLocator}) {op} ?", value));
        }
Exemplo n.º 27
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var members = FindMembers.Determine(expression);

            var locator = mapping.FieldFor(members).SqlLocator;
            var value   = expression.Arguments.Last().Value();

            return(new WhereFragment($"{locator} ~~* ?", value.As <string>()));
        }
Exemplo n.º 28
0
 public void WriteSelectClause(CommandBuilder sql, IQueryableDocument mapping)
 {
     _inner.WriteSelectClause(sql, mapping);
     foreach (var @join in _joins)
     {
         sql.Append(" ");
         @join.AppendJoin(sql, "d", mapping);
     }
 }
Exemplo n.º 29
0
        public static string JsonLocator(this IQueryableDocument mapping, Expression expression)
        {
            var visitor = new FindMembers();

            visitor.Visit(expression);

            var field = mapping.FieldFor(visitor.Members);

            return(field.SqlLocator);
        }
Exemplo n.º 30
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var locator = GetLocator(mapping, expression);

            var value = expression.Arguments.OfType<ConstantExpression>().FirstOrDefault();
            if (value == null) throw new BadLinqExpressionException("Could not extract string value from {0}.".ToFormat(expression), null);

            var stringOperator = GetOperator(expression);
            return new WhereFragment("{0} {1} ?".ToFormat(locator, stringOperator), FormatValue(expression.Method, value.Value as string));
        }
Exemplo n.º 31
0
        public JsonQueryHandler(IDocumentSchema schema, QueryModel query)
        {
            _mapping = schema.MappingFor(query).ToQueryableDocument();
            _schema  = schema;
            _query   = query;

            var selector = _schema.BuildSelector <string>(_mapping, _query);

            _selector = selector;
        }
Exemplo n.º 32
0
        public static string ToOrderClause(this QueryModel query, IQueryableDocument mapping)
        {
            var orders = query.BodyClauses.OfType <OrderByClause>().SelectMany(x => x.Orderings).ToArray();

            if (!orders.Any())
            {
                return(string.Empty);
            }

            return(" order by " + orders.Select(c => ToOrderClause(c, mapping)).Join(", "));
        }
Exemplo n.º 33
0
        // TODO -- pull this out somewhere else
        private IWhereFragment buildSimpleWhereClause(IQueryableDocument mapping, BinaryExpression binary)
        {
            var isValueExpressionOnRight = binary.Right.IsValueExpression();
            var jsonLocatorExpression = isValueExpressionOnRight ? binary.Left : binary.Right;
            var valueExpression = isValueExpressionOnRight ? binary.Right : binary.Left;

            var op = _operators[binary.NodeType];

            var isSubQuery = isValueExpressionOnRight
                ? binary.Left is SubQueryExpression
                : binary.Right is SubQueryExpression;

            if (isSubQuery)
            {
                return buildChildCollectionQuery(mapping, jsonLocatorExpression.As<SubQueryExpression>().QueryModel, valueExpression, op);
            }

            var members = FindMembers.Determine(jsonLocatorExpression);

            var field = mapping.FieldFor(members);


            var value = field.GetValue(valueExpression);
            var jsonLocator = field.SqlLocator;

            var useContainment = mapping.PropertySearching == PropertySearching.ContainmentOperator || field.ShouldUseContainmentOperator();

            var isDuplicated = (mapping.FieldFor(members) is DuplicatedField);

            if (useContainment &&
                binary.NodeType == ExpressionType.Equal && value != null && !isDuplicated)
            {
                return new ContainmentWhereFragment(_serializer, binary);
            }

            

            if (value == null)
            {
                var sql = binary.NodeType == ExpressionType.NotEqual
                    ? $"({jsonLocator}) is not null"
                    : $"({jsonLocator}) is null";

                return new WhereFragment(sql);
            }
            if (jsonLocatorExpression.NodeType == ExpressionType.Modulo)
            {
                var moduloByValue = MartenExpressionParser.moduloByValue(binary);
                return new WhereFragment("{0} % {1} {2} ?".ToFormat(jsonLocator, moduloByValue, op), value);
            }


            return new WhereFragment("{0} {1} ?".ToFormat(jsonLocator, op), value);
        }
Exemplo n.º 34
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            MemberInfo[] members = FindMembers.Determine(expression);

            string locator = mapping.FieldFor(members).SqlLocator;
            object values  = expression.Arguments.Last().Value();

            string json = serializer.ToJson(values);

            return(new CustomizableWhereFragment($"{locator} @> ?", "?", Tuple.Create <object, NpgsqlDbType?>(json, NpgsqlDbType.Jsonb)));
        }
Exemplo n.º 35
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var finder = new FindMembers();
            finder.Visit(expression);

            var members = finder.Members;

            var locator = mapping.FieldFor(members).SqlLocator;
            var values = expression.Object.Value();

            return new WhereFragment($"{locator} = ANY(?)", values);
        }
Exemplo n.º 36
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var members = FindMembers.Determine(expression);

            var locator = mapping.FieldFor(members).SqlLocator;
            var values = expression.Arguments.Last().Value();

            if (members.Last().GetMemberType().GetTypeInfo().IsEnum)
            {
                return new EnumIsOneOfWhereFragment(values, serializer.EnumStorage, locator);
            }

            return new WhereFragment($"{locator} = ANY(?)", values);
        }
Exemplo n.º 37
0
 /// <summary>
 ///     Returns a locator for the member being queried upon
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="expression"></param>
 /// <returns></returns>
 protected virtual string GetLocator(IQueryableDocument mapping, MethodCallExpression expression)
 {
     if (!expression.Method.IsStatic && expression.Object != null && expression.Object.NodeType != ExpressionType.Constant)
     {
         // x.member.Equals(...)
         return mapping.JsonLocator(expression.Object);
     }
     if (expression.Arguments[0].NodeType == ExpressionType.Constant)
     {
         // string.Equals("value", x.member)
         return mapping.JsonLocator(expression.Arguments[1]);
     }
     // string.Equals(x.member, "value")
     return mapping.JsonLocator(expression.Arguments[0]);
 }
Exemplo n.º 38
0
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var finder = new FindMembers();
            finder.Visit(expression);
            var members = finder.Members;
            var fieldlocator = mapping.FieldFor(members).SqlLocator;

            if (IsCollectionContainsWithStringKey(expression.Method))
            {
                return QueryFromICollectionContains(expression, fieldlocator, serializer);
            }
            else if (IsDictionaryContainsKey(expression.Method))
            {
                return QueryFromDictionaryContainsKey(expression, fieldlocator);
            }
            else throw new NotImplementedException("Could not understand the format of the dictionary access");
        }
Exemplo n.º 39
0
        public IWhereFragment ParseWhereFragment(IQueryableDocument mapping, Expression expression)
        {
            if (expression is LambdaExpression)
            {
                expression = expression.As<LambdaExpression>().Body;
            }

            var visitor = new WhereClauseVisitor(this, mapping);
            visitor.Visit(expression);
            var whereFragment = visitor.ToWhereFragment();

            if (whereFragment == null)
            {
                throw new NotSupportedException("Marten does not (yet) support this Linq query type");
            }

            return whereFragment;
        }
        public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
        {
            var locator = mapping.FieldFor(new MemberInfo[] {_property}).SqlLocator;

            return new WhereFragment($"{locator} = 'Blue'");
        }
Exemplo n.º 41
0
 public CompoundWhereFragment(MartenExpressionParser parser, IQueryableDocument mapping, string separator, IEnumerable<WhereClause> wheres)
 {
     _separator = separator;
     _children = wheres.Select(x => parser.ParseWhereFragment(mapping, x.Predicate)).ToArray();
 }
Exemplo n.º 42
0
 public NotVisitor(MartenExpressionParser.WhereClauseVisitor parent, IQueryableDocument mapping, Action<IWhereFragment> callback)
 {
     _parent = parent;
     _mapping = mapping;
     _callback = callback;
 }
Exemplo n.º 43
0
 public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
 {
     return _whereFragment;
 }
Exemplo n.º 44
0
        private IWhereFragment buildChildCollectionQuery(IQueryableDocument mapping, QueryModel query, Expression valueExpression, string op)
        {
            var members = FindMembers.Determine(query.MainFromClause.FromExpression);
            var field = mapping.FieldFor(members);

            if (query.HasOperator<CountResultOperator>())
            {
                var value = field.GetValue(valueExpression);

                return new WhereFragment($"jsonb_array_length({field.SqlLocator}) {op} ?", value);
            }

            throw new NotSupportedException("Marten does not yet support this type of Linq query against child collections");
        }
Exemplo n.º 45
0
 public WhereClauseVisitor(MartenExpressionParser parent, IQueryableDocument mapping)
 {
     _parent = parent;
     _mapping = mapping;
     _register.Push(x => _top = x);
 }
Exemplo n.º 46
0
 public IWhereFragment Parse(IQueryableDocument mapping, ISerializer serializer, MethodCallExpression expression)
 {
     var value = expression.Arguments.Single().Value();
     return ContainmentWhereFragment.SimpleArrayContains(FindMembers.Determine(expression.Object) ,serializer, expression.Object, value);
 }