コード例 #1
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.Arguments.Last().Value();

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

            return(new WhereFragment($"{locator} = ANY(?)", values));
        }
コード例 #2
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");
            }
        }