コード例 #1
0
        public void InitDb(DataType dbtype, string connstr)
        {
            this.DbContext = new DbContext(connstr);
            switch (dbtype)
            {
            case DataType.Oledb:
                connstr              = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + connstr;
                DbContext.ConnStr    = connstr;
                DbContext.DbProvider = new OleDbProvider();
                break;

            case DataType.Mssql:
                DbContext.DbProvider = new SqlProvider();
                break;

            case DataType.Mysql:
                DbContext.DbProvider = new MySqlProvider();
                break;

            default:
                throw new ArgumentException("未支持的provider:" + dbtype.ToString(), "provider");
            }
            if (_da == null)
            {
                _da = new NjhDataSqlExecutor(this.DbContext);
            }
        }
コード例 #2
0
 public NjhDataEntityOPerationMsSql(NjhDataSqlExecutor executor)
 {
     this._executor = executor;
 }
コード例 #3
0
 public OledbEntityOperation(NjhDataSqlExecutor factory)
 {
     this.conn      = (OleDbConnection)factory.CreateConnection();
     this._executor = factory;
 }