예제 #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;
 }
예제 #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));
        }
예제 #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>();
 }
예제 #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));
        }
예제 #5
0
 private RelationshipBinder(QueryMapper mapper)
 {
     this.mapper   = mapper;
     this.mapping  = mapper.Mapping;
     this.language = mapper.Translator.Linguist.Language;
 }
예제 #6
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new CrossApplyRewriter(language).Visit(expression));
 }
예제 #7
0
 public static Expression Rewrite(QueryLanguage language, Expression expr)
 {
     return(new AggregateRewriter(language, expr).Visit(expr));
 }
예제 #8
0
 private Parameterizer(QueryLanguage language)
 {
     this.language = language;
 }
예제 #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);
 }
예제 #10
0
 private SingletonProjectionRewriter(QueryLanguage language)
 {
     this.language = language;
 }
예제 #11
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToRowNumberRewriter(language).Visit(expression));
 }
예제 #12
0
 private SkipToRowNumberRewriter(QueryLanguage language)
 {
     this.language = language;
 }
예제 #13
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SkipToNestedOrderByRewriter(language).Visit(expression));
 }
예제 #14
0
 private SkipToNestedOrderByRewriter(QueryLanguage language)
 {
     this.language = language;
 }
예제 #15
0
 public static Expression Rewrite(QueryPolicy policy, QueryLanguage language, Expression expression)
 {
     return(new ClientJoinedProjectionRewriter(policy, language).Visit(expression));
 }
예제 #16
0
 private ClientJoinedProjectionRewriter(QueryPolicy policy, QueryLanguage language)
 {
     this.policy   = policy;
     this.language = language;
 }
예제 #17
0
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return(new SingletonProjectionRewriter(language).Visit(expression));
 }
예제 #18
0
 private OrderByRewriter(QueryLanguage language)
 {
     this.language          = language;
     this.isOuterMostSelect = true;
 }
예제 #19
0
 public QueryLinguist(QueryLanguage language, QueryTranslator translator)
 {
     this.language   = language;
     this.translator = translator;
 }
예제 #20
0
 private CrossApplyRewriter(QueryLanguage language)
 {
     this.language = language;
 }
예제 #21
0
 public static Expression Parameterize(QueryLanguage language, Expression expression)
 {
     return(new Parameterizer(language).Visit(expression));
 }
예제 #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);
 }