private IDbContext CreateDbContext(IDbContext ctx) { connection.StateChange += new StateChangeEventHandler(connection_StateChange); if (!(connection is DbConnectionWrapper)) { switch (DbProviderName) { case DbProviderNames.Oracle_ODP: connection = new ODPConnectionWrapper(this,connection); break; case DbProviderNames.SQLite: connection = new SQLiteConnectionWrapper(this, connection) { IsFileDatabase = true }; break; case DbProviderNames.SqlCe40: case DbProviderNames.SqlCe35: case DbProviderNames.Oledb : connection = new DbConnectionWrapper(this, connection) { IsFileDatabase = true }; break; default: connection = new DbConnectionWrapper(this,connection); break; } } ctx = new InternalDbContext(this, connection); return ctx; }
protected DbExpressionWriter(TextWriter writer) : base(writer) { this.dbContext = ExecuteContext.DbContext; }
public static Expression Bind(InternalDbContext dbContext, Expression exp) { var instance = new FunctionBinder { DbContext = dbContext }; return instance.Visit(exp); }
/// <summary> /// 创建DbContext(必须先注册实体到数据表的映射后才可创建DbContext) /// </summary> /// <returns></returns> public IDbContext CreateDbContext() { Guard.NotNull(Option.Dialect, "dialect"); IDbContext ctx = null; if (connection == null) ctx = new InternalDbContext(this); else ctx = CreateDbContext(ctx); return ctx; }
public static Expression Rewrite(InternalDbContext dbContext,Expression expression) { return new ClientJoinedProjectionRewriter(dbContext).Visit(expression); }
private ClientJoinedProjectionRewriter(InternalDbContext dbContext) { this.policy = dbContext; this.dbExpressionBuilder = dbContext.ExpressionBuilder; }
public static Expression Rewrite(InternalDbContext dbContext, Expression expression) { return(new ClientJoinedProjectionRewriter(dbContext).Visit(expression)); }