0
|
1 using System;
|
|
2 using System.Linq.Expressions;
|
|
3
|
|
4 namespace BLToolkit.Data.Linq.Builder
|
|
5 {
|
|
6 using Data.Sql;
|
|
7
|
|
8 public abstract class PassThroughContext : IBuildContext
|
|
9 {
|
|
10 protected PassThroughContext(IBuildContext context)
|
|
11 {
|
|
12 Context = context;
|
|
13
|
|
14 context.Builder.Contexts.Add(this);
|
|
15 }
|
|
16
|
|
17 public IBuildContext Context { get; set; }
|
|
18
|
|
19 #if DEBUG
|
|
20 string IBuildContext._sqlQueryText { get { return Context._sqlQueryText; } }
|
|
21 #endif
|
|
22
|
|
23 public virtual ExpressionBuilder Builder { get { return Context.Builder; } }
|
|
24 public virtual Expression Expression { get { return Context.Expression; } }
|
|
25 public virtual SqlQuery SqlQuery { get { return Context.SqlQuery; } set { Context.SqlQuery = value; } }
|
|
26 public virtual IBuildContext Parent { get { return Context.Parent; } set { Context.Parent = value; } }
|
|
27
|
|
28 public virtual void BuildQuery<T>(Query<T> query, ParameterExpression queryParameter)
|
|
29 {
|
|
30 Context.BuildQuery(query, queryParameter);
|
|
31 }
|
|
32
|
|
33 public virtual Expression BuildExpression(Expression expression, int level)
|
|
34 {
|
|
35 return Context.BuildExpression(expression, level);
|
|
36 }
|
|
37
|
|
38 public virtual SqlInfo[] ConvertToSql(Expression expression, int level, ConvertFlags flags)
|
|
39 {
|
|
40 return Context.ConvertToSql(expression, level, flags);
|
|
41 }
|
|
42
|
|
43 public virtual SqlInfo[] ConvertToIndex(Expression expression, int level, ConvertFlags flags)
|
|
44 {
|
|
45 return Context.ConvertToIndex(expression, level, flags);
|
|
46 }
|
|
47
|
|
48 public virtual IsExpressionResult IsExpression(Expression expression, int level, RequestFor requestFlag)
|
|
49 {
|
|
50 return Context.IsExpression(expression, level, requestFlag);
|
|
51 }
|
|
52
|
|
53 public virtual IBuildContext GetContext(Expression expression, int level, BuildInfo buildInfo)
|
|
54 {
|
|
55 return Context.GetContext(expression, level, buildInfo);
|
|
56 }
|
|
57
|
|
58 public virtual int ConvertToParentIndex(int index, IBuildContext context)
|
|
59 {
|
|
60 return Context.ConvertToParentIndex(index, context);
|
|
61 }
|
|
62
|
|
63 public virtual void SetAlias(string alias)
|
|
64 {
|
|
65 Context.SetAlias(alias);
|
|
66 }
|
|
67
|
|
68 public virtual ISqlExpression GetSubQuery(IBuildContext context)
|
|
69 {
|
|
70 return Context.GetSubQuery(context);
|
|
71 }
|
|
72 }
|
|
73 }
|