System.Data.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.Join(System.Data.Common.CommandTrees.DbExpression, System.Data.Common.CommandTrees.DbExpression, System.Func, System.Func)

Here are the examples of the csharp api class System.Data.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.Join(System.Data.Common.CommandTrees.DbExpression, System.Data.Common.CommandTrees.DbExpression, System.Func, System.Func) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

View license
public static DbProjectExpression Join<TSelector>(this DbExpression outer, DbExpression inner, Func<DbExpression, DbExpression> outerKey, Func<DbExpression, DbExpression> innerKey, Func<DbExpression, DbExpression, TSelector> selector)
        {
            // Defer argument validation for all but the selector to the selector-less overload of Join
            DbJoinExpression joinExpression = DbExpressionBuilder.Join(outer, inner, outerKey, innerKey);

            // Ensure that the selector is non-null;
            EntityUtil.CheckArgumentNull(selector, "selector");

            // Bind the join expression and produce the selector based on the left and right inputs
            DbExpressionBinding joinBinding = DbExpressionBuilder.Bind(joinExpression);
            DbExpression left = DbExpressionBuilder.Property(joinBinding.Variable, joinExpression.Left.VariableName);
            DbExpression right = DbExpressionBuilder.Property(joinBinding.Variable, joinExpression.Right.VariableName);
            TSelector intermediateSelector = selector(left, right);
            DbExpression projection = DbExpressionBuilder.ResolveToExpression(intermediateSelector);

            // Project the selector over the join expression and return the resulting DbProjectExpression
            return DbExpressionBuilder.Project(joinBinding, projection);
        }