//Returns a list of materialized entities for a given resultSet representing TableEntities. protected List <object> Materialize(IEnumerable <AnonymousType> resultSet, ProjectedType projectedType) { var getProjection = Get_GetProjection_Computation(projectedType, resultSet.Cast <object>()); var objects = new List <object>(); foreach (var result in resultSet) { var tableSource = new TableEntityRow(result); objects.Add(getProjection(tableSource.Values[0], tableSource)); } return(objects); }
//If the ProjectedType appears again in the Type-Tracking Tree, handle it. private Func <object, TableEntityRow, object> Get_HandleProjectedType_Computation(SimpleType trackedType, MaterializationData data) { var valueGetter = Get_FindValueInTreeMatchingTrackedType_Computation(data.ProjectedType, trackedType); var newResults = data.ResultSet.Select(result => valueGetter(result)).ToList(); var getProjectionValue = Get_GetProjection_Computation(trackedType as ProjectedType, newResults); return((tableEntity, source) => { var newRow = new TableEntityRow(tableEntity as AnonymousType); return getProjectionValue(newRow.Values[0], newRow); }); }