Exemplo n.º 1
0
 public DbEntityProvider(DbConnection connection, QueryLanguage language, QueryMapping mapping, QueryPolicy policy)
     : base(language, mapping, policy)
 {
     if (connection == null)
     {
         throw new InvalidOperationException("Connection not specified");
     }
     this.connection = connection;
 }
Exemplo n.º 2
0
        public static SelectExpression AddRedundantSelect(this SelectExpression sel, QueryLanguage language, TableAlias newAlias)
        {
            var newColumns =
                from d in sel.Columns
                let qt = (d.Expression is ColumnExpression) ? ((ColumnExpression)d.Expression).QueryType : language.TypeSystem.GetColumnType(d.Expression.Type)
                         select new ColumnDeclaration(d.Name, new ColumnExpression(d.Expression.Type, qt, newAlias, d.Name), qt);

            var newFrom = new SelectExpression(newAlias, sel.Columns, sel.From, sel.Where, sel.OrderBy, sel.GroupBy, sel.IsDistinct, sel.Skip, sel.Take, sel.IsReverse);

            return(new SelectExpression(sel.Alias, newColumns, newFrom, null, null, null, false, null, null, false));
        }
Exemplo n.º 3
0
 public EntityProvider(QueryLanguage language, QueryMapping mapping, QueryPolicy policy)
 {
     if (language == null)
     {
         throw new InvalidOperationException("Language not specified");
     }
     if (mapping == null)
     {
         throw new InvalidOperationException("Mapping not specified");
     }
     if (policy == null)
     {
         throw new InvalidOperationException("Policy not specified");
     }
     this.language = language;
     this.mapping  = mapping;
     this.policy   = policy;
     this.tables   = new Dictionary <MappingEntity, IEntityTable>();
 }
Exemplo n.º 4
0
        public static ProjectionExpression AddOuterJoinTest(this ProjectionExpression proj, QueryLanguage language, Expression expression)
        {
            string           colName      = proj.Select.Columns.GetAvailableColumnName("Test");
            var              colType      = language.TypeSystem.GetColumnType(expression.Type);
            SelectExpression newSource    = proj.Select.AddColumn(new ColumnDeclaration(colName, expression, colType));
            Expression       newProjector =
                new OuterJoinedExpression(
                    new ColumnExpression(expression.Type, colType, newSource.Alias, colName),
                    proj.Projector
                    );

            return(new ProjectionExpression(newSource, newProjector, proj.Aggregator));
        }
Exemplo n.º 5
0
 private RelationshipBinder(QueryMapper mapper)
 {
     this.mapper   = mapper;
     this.mapping  = mapper.Mapping;
     this.language = mapper.Translator.Linguist.Language;
 }
Exemplo n.º 6
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new CrossApplyRewriter(language).Visit(expression));
 }
Exemplo n.º 7
0
 public static Expression Rewrite(QueryLanguage language, Expression expr)
 {
     return(new AggregateRewriter(language, expr).Visit(expr));
 }
Exemplo n.º 8
0
 private Parameterizer(QueryLanguage language)
 {
     this.language = language;
 }
Exemplo n.º 9
0
 public QueryTranslator(QueryLanguage language, QueryMapping mapping, QueryPolicy policy)
 {
     this.linguist = language.CreateLinguist(this);
     this.mapper   = mapping.CreateMapper(this);
     this.police   = policy.CreatePolice(this);
 }
Exemplo n.º 10
0
 private SingletonProjectionRewriter(QueryLanguage language)
 {
     this.language = language;
 }
Exemplo n.º 11
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToRowNumberRewriter(language).Visit(expression));
 }
Exemplo n.º 12
0
 private SkipToRowNumberRewriter(QueryLanguage language)
 {
     this.language = language;
 }
Exemplo n.º 13
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToNestedOrderByRewriter(language).Visit(expression));
 }
Exemplo n.º 14
0
 private SkipToNestedOrderByRewriter(QueryLanguage language)
 {
     this.language = language;
 }
Exemplo n.º 15
0
 public static Expression Rewrite(QueryPolicy policy, QueryLanguage language, Expression expression)
 {
     return(new ClientJoinedProjectionRewriter(policy, language).Visit(expression));
 }
Exemplo n.º 16
0
 private ClientJoinedProjectionRewriter(QueryPolicy policy, QueryLanguage language)
 {
     this.policy   = policy;
     this.language = language;
 }
Exemplo n.º 17
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SingletonProjectionRewriter(language).Visit(expression));
 }
Exemplo n.º 18
0
 private OrderByRewriter(QueryLanguage language)
 {
     this.language          = language;
     this.isOuterMostSelect = true;
 }
Exemplo n.º 19
0
 public QueryLinguist(QueryLanguage language, QueryTranslator translator)
 {
     this.language   = language;
     this.translator = translator;
 }
Exemplo n.º 20
0
 private CrossApplyRewriter(QueryLanguage language)
 {
     this.language = language;
 }
Exemplo n.º 21
0
 public static Expression Parameterize(QueryLanguage language, Expression expression)
 {
     return(new Parameterizer(language).Visit(expression));
 }
Exemplo n.º 22
0
 private AggregateRewriter(QueryLanguage language, Expression expr)
 {
     this.language = language;
     this.map      = new Dictionary <AggregateSubqueryExpression, Expression>();
     this.lookup   = AggregateGatherer.Gather(expr).ToLookup(a => a.GroupByAlias);
 }