Exemplo n.º 1
0
        /// <summary>
        /// Resolves types for the specified expression.
        /// </summary>
        /// <param name="expression">The expression to resolve types for.</param>
        /// <returns>Expression with resolved types.</returns>
        public QueryExpression Visit(LinqGroupJoinExpression expression)
        {
            var outer            = this.ResolveTypes(expression.Outer);
            var inner            = this.ResolveTypes(expression.Inner);
            var outerType        = ValidateSourceIsACollection(outer);
            var innerType        = ValidateSourceIsACollection(inner);
            var outerKeySelector = this.ResolveLambdaTypes(expression.OuterKeySelector, outerType);
            var innerKeySelector = this.ResolveLambdaTypes(expression.InnerKeySelector, innerType);

            var resultSelector = this.ResolveLambdaTypes(expression.ResultSelector, outerType, innerType.CreateCollectionType());

            return(LinqBuilder.GroupJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector, resultSelector.Body.ExpressionType.CreateCollectionType()));
        }