public Action <TInclude> Resolve(PropertyInfo property, IncludeTypeContainer typeContainer)
        {
            Action <TInclude> callback;

            if (typeContainer.IncludeType.IsGenericEnumerable())
            {
                typeContainer.IncludeType = typeContainer.IncludeType.GenericTypeArguments[0];
                callback = GetJoinListCallback(property, _includeOperator, _query);
            }
            else
            {
                callback = GetJoinCallback(property, _includeOperator, _query);
            }
            return(callback);
        }
Exemple #2
0
        private IIncludeJoin doGetJoin <TInclude>(ICompiledQuery <TDoc, TOut> query, IncludeResultOperator includeOperator, IIncludeCallbackResolver <TInclude> callbackResolver) where TInclude : class
        {
            var idSource = includeOperator.IdSource as Expression <Func <TDoc, object> >;
            var joinType = (JoinType)includeOperator.JoinType.Value;

            var visitor = new FindMembers();

            visitor.Visit(idSource);
            var members = visitor.Members.ToArray();

            var mapping       = _schema.MappingFor(typeof(TDoc)).ToQueryableDocument();
            var typeContainer = new IncludeTypeContainer {
                IncludeType = includeOperator.Callback.Body.Type
            };

            var property = typeof(IncludeResultOperator).GetProperty("Callback");

            var callback = callbackResolver.Resolve(property, typeContainer);

            var included = _schema.MappingFor(typeContainer.IncludeType).ToQueryableDocument();

            return(mapping.JoinToInclude(joinType, included, members, callback));
        }
 public Action <TInclude> Resolve(PropertyInfo property, IncludeTypeContainer typeContainer)
 {
     typeContainer.IncludeType = typeContainer.IncludeType.GenericTypeArguments[1];
     return(GetJoinDictionaryCallback(property, _includeOperator, _query));
 }