public static IAggregateFluent <TAgg> UnionWith <TAgg, TOther>(this IAggregateFluent <TAgg> aggregation, IRepository <TOther> other, Expression <Func <TOther, TAgg> > projection) { var otherImpl = other as MongoRepository <TOther>; var pipelineDefinition = PipelineDefinitionBuilder.For <TOther>().Project(projection); return(aggregation.UnionWith( otherImpl.Collection, pipelineDefinition )); }