19 using System.Collections.Generic;
20 using System.Linq.Expressions;
25 namespace Deveel.Data.Linq {
30 columnQueries =
new List<ColumnQuery>();
34 columnQueries.Add(
new ColumnQuery(columnName, expression));
37 public void Column(
string columnName, Expression expression) {
39 throw new NotImplementedException();
42 public IEnumerable
Execute(Type elementType, ITable table) {
43 var mapping =
new TableTypeMapper(elementType);
45 var finalTable = table;
46 foreach (var columnQuery
in columnQueries) {
47 finalTable = ExecuteColumnQuery(finalTable, columnQuery);
50 mapping.BuildMap(finalTable);
52 var listType = typeof (List<>).MakeGenericType(elementType);
53 var result = (IList) Activator.CreateInstance(listType);
55 foreach (var row
in finalTable) {
56 var rowNumber = row.RowId.RowNumber;
57 var mapped = mapping.Construct(finalTable, rowNumber);
66 return table.ExhaustiveSelect(null, expression);
void Column(string columnName, Expression expression)
void Column(string columnName, SqlExpression expression)
ITable ExecuteColumnQuery(ITable table, ColumnQuery columnQuery)
IEnumerable Execute(Type elementType, ITable table)
Defines the base class for instances that represent SQL expression tree nodes.
readonly List< ColumnQuery > columnQueries