public void Each_Db_Have_Own_Connection() { var db = new Db(); var db2 = new Db(); db.Initialize(TestConstants.SqlClientConnectionString, "System.Data.SqlClient", ConnectionStrategyType.Manual); db2.Initialize(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\romag\Documents\Visual Studio 2015\Projects\EasyDb\EasyDbTests\NorthWind.mdb", "System.Data.OleDb"); db.Open(); Assert.AreEqual(db.Connection.ConnectionString, TestConstants.SqlClientConnectionString); Assert.AreEqual(db.Connection.Provider, "System.Data.SqlClient"); Assert.AreEqual(db.Connection.ConnectionStrategy, ConnectionStrategyType.Manual); Assert.AreEqual(db.Connection.State, System.Data.ConnectionState.Open); Assert.AreEqual(db2.Connection.ConnectionString, @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\romag\Documents\Visual Studio 2015\Projects\EasyDb\EasyDbTests\NorthWind.mdb"); Assert.AreEqual(db2.Connection.Provider, "System.Data.OleDb"); Assert.AreEqual(db2.Connection.ConnectionStrategy, ConnectionStrategyType.Automatic); Assert.AreEqual(db2.Connection.State, System.Data.ConnectionState.Closed); db.Close(); }
/// <summary> /// ��ʼ�� /// </summary> private void Init() { env = new Env(EnvCreateFlags.None); Env.OpenFlags envFlags = Env.OpenFlags.Create | Env.OpenFlags.InitLock | Env.OpenFlags.InitLog | Env.OpenFlags.InitMPool | Env.OpenFlags.InitTxn | Env.OpenFlags.Recover; env.Open(directory, envFlags, 0); txn = env.TxnBegin(null, Txn.BeginFlags.None); db = env.CreateDatabase(DbCreateFlags.None); btree = (DbHash)db.Open(txn, dbName, null, DbType.Hash, Db.OpenFlags.Create, 0); }