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;
 }
Exemple #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));
        }
 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>();
 }
Exemple #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));
        }
Exemple #5
0
 private RelationshipBinder(QueryMapper mapper)
 {
     this.mapper   = mapper;
     this.mapping  = mapper.Mapping;
     this.language = mapper.Translator.Linguist.Language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new CrossApplyRewriter(language).Visit(expression));
 }
 public static Expression Rewrite(QueryLanguage language, Expression expr)
 {
     return(new AggregateRewriter(language, expr).Visit(expr));
 }
Exemple #8
0
 private Parameterizer(QueryLanguage language)
 {
     this.language = language;
 }
Exemple #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);
 }
 private SingletonProjectionRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToRowNumberRewriter(language).Visit(expression));
 }
 private SkipToRowNumberRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToNestedOrderByRewriter(language).Visit(expression));
 }
 private SkipToNestedOrderByRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 public static Expression Rewrite(QueryPolicy policy, QueryLanguage language, Expression expression)
 {
     return(new ClientJoinedProjectionRewriter(policy, language).Visit(expression));
 }
 private ClientJoinedProjectionRewriter(QueryPolicy policy, QueryLanguage language)
 {
     this.policy   = policy;
     this.language = language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SingletonProjectionRewriter(language).Visit(expression));
 }
 private OrderByRewriter(QueryLanguage language)
 {
     this.language          = language;
     this.isOuterMostSelect = true;
 }
Exemple #19
0
 public QueryLinguist(QueryLanguage language, QueryTranslator translator)
 {
     this.language   = language;
     this.translator = translator;
 }
 private CrossApplyRewriter(QueryLanguage language)
 {
     this.language = language;
 }
Exemple #21
0
 public static Expression Parameterize(QueryLanguage language, Expression expression)
 {
     return(new Parameterizer(language).Visit(expression));
 }
 private AggregateRewriter(QueryLanguage language, Expression expr)
 {
     this.language = language;
     this.map      = new Dictionary <AggregateSubqueryExpression, Expression>();
     this.lookup   = AggregateGatherer.Gather(expr).ToLookup(a => a.GroupByAlias);
 }