static TranslateResult <T> BuildPrivate <T>(ProjectionExpression proj) { var eagerChildProjections = EagerChildProjectionGatherer.Gatherer(proj).Select(cp => BuildChild(cp)).ToList(); var lazyChildProjections = LazyChildProjectionGatherer.Gatherer(proj).Select(cp => BuildChild(cp)).ToList(); Scope scope = new Scope { Alias = proj.Select.Alias, Positions = proj.Select.Columns.Select((c, i) => new { c.Name, i }).ToDictionary(p => p.Name, p => p.i), }; Expression <Func <IProjectionRow, T> > lambda = ProjectionBuilder.Build <T>(proj.Projector, scope); var command = QueryFormatter.Format(proj.Select); var result = new TranslateResult <T> { EagerProjections = eagerChildProjections, LazyChildProjections = lazyChildProjections, MainCommand = command, ProjectorExpression = lambda, Unique = proj.UniqueFunction, }; return(result); }
static TranslateResult <T> BuildPrivate <T>(ProjectionExpression proj) { var eagerChildProjections = EagerChildProjectionGatherer.Gatherer(proj).Select(cp => BuildChild(cp)).ToList(); var lazyChildProjections = LazyChildProjectionGatherer.Gatherer(proj).Select(cp => BuildChild(cp)).ToList(); Scope scope = new Scope( alias: proj.Select.Alias, positions: proj.Select.Columns.Select((c, i) => new { c.Name, i }).ToDictionary(p => p.Name !, p => p.i) /*CSBUG*/ ); Expression <Func <IProjectionRow, T> > lambda = ProjectionBuilder.Build <T>(proj.Projector, scope); var command = QueryFormatter.Format(proj.Select); var result = new TranslateResult <T>( eagerProjections: eagerChildProjections, lazyChildProjections: lazyChildProjections, mainCommand: command, projectorExpression: lambda, unique: proj.UniqueFunction ); return(result); }
public static List <ChildProjectionExpression> Gatherer(ProjectionExpression proj) { LazyChildProjectionGatherer pg = new LazyChildProjectionGatherer(); pg.Visit(proj); return(pg.list); }