/// <summary> /// Create an instance and abandon it. Garbage collection should /// be able to finalize the instance. /// </summary> private static void CreateOneInstance() { var instance = new Instance("finalize_me"); SetupHelper.SetLightweightConfiguration(instance); instance.Init(); }
public void CreateAndOpenDatabaseSimpleOverloads() { string dir = SetupHelper.CreateRandomDirectory(); JET_INSTANCE instance = SetupHelper.CreateNewInstance(dir); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetInit(ref instance); try { string database = Path.Combine(dir, "test.db"); JET_SESID sesid; JET_DBID dbid; Api.BeginSession(instance, out sesid); Api.CreateDatabase(sesid, database, out dbid, CreateDatabaseGrbit.None); Api.JetCloseDatabase(sesid, dbid, CloseDatabaseGrbit.None); Api.JetDetachDatabase2(sesid, database, DetachDatabaseGrbit.None); Api.JetAttachDatabase(sesid, database, AttachDatabaseGrbit.None); Api.OpenDatabase(sesid, database, out dbid, OpenDatabaseGrbit.None); Api.JetCloseDatabase(sesid, dbid, CloseDatabaseGrbit.None); Api.JetDetachDatabase(sesid, database); } finally { Api.JetTerm(instance); Cleanup.DeleteDirectoryWithRetry(dir); } }
public void JetSetDatabaseSizeThrowsExceptionWhenDesiredPagesIsNegative() { string dir = SetupHelper.CreateRandomDirectory(); JET_INSTANCE instance = SetupHelper.CreateNewInstance(dir); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref instance); string database = Path.Combine(dir, "test.db"); JET_SESID sesid; JET_DBID dbid; Api.JetBeginSession(instance, out sesid, string.Empty, string.Empty); try { Api.JetCreateDatabase(sesid, database, string.Empty, out dbid, CreateDatabaseGrbit.None); int actualPages; Api.JetSetDatabaseSize(sesid, database, -1, out actualPages); } finally { Api.JetTerm(instance); Cleanup.DeleteDirectoryWithRetry(dir); } }
/// <summary> /// Init and term an instance. This is used to make sure the instance /// is always cleaned up when the thread is terminated. If the cleanup /// is missed the next instance create will fail. /// </summary> /// <param name="instanceName"> /// The name of the instance to create. /// </param> private static void InstanceInitTermThread(string instanceName) { try { while (true) { using (var instance = new Instance(instanceName)) { SetupHelper.SetLightweightConfiguration(instance); instance.Init(); instance.Term(); } } } catch (ThreadAbortException) { // Actually letting the thread abort will fail the test, exit // gracefully instead. Thread.ResetAbort(); } catch (EsentErrorException ex) { Console.WriteLine("Got exception {0}", ex); Assert.Fail("Got exception {0}", ex); } }
public void CreateResizeAndTrimDatabase() { if (!EsentVersion.SupportsWindows81Features) { return; } string dir = SetupHelper.CreateRandomDirectory(); JET_INSTANCE instance = SetupHelper.CreateNewInstance(dir); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); InstanceParameters instanceParameters = new InstanceParameters(instance); instanceParameters.EnableShrinkDatabase = ShrinkDatabaseGrbit.On; Api.JetInit(ref instance); try { string database = Path.Combine(dir, "CreateAndResizeDatabase.db"); JET_SESID sesid; JET_DBID dbid; Api.JetBeginSession(instance, out sesid, string.Empty, string.Empty); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.DbExtensionSize, 256, null); Api.JetCreateDatabase(sesid, database, string.Empty, out dbid, CreateDatabaseGrbit.None); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.DbExtensionSize, 1, null); int databaseSpaceOwned; Api.JetGetDatabaseInfo(sesid, dbid, out databaseSpaceOwned, JET_DbInfo.SpaceOwned); // We have to take into account the reserved pages in the database as per the API to get the actual // space. databaseSpaceOwned += ReservedPages; int actualPages; Windows8Api.JetResizeDatabase(sesid, dbid, databaseSpaceOwned + 100, out actualPages, ResizeDatabaseGrbit.None); EseInteropTestHelper.ConsoleWriteLine("actualPages is {0}.", actualPages); Assert.IsTrue(actualPages >= databaseSpaceOwned + 100, "Database didn't grow enough!"); int actualPagesAfterTrim = 0; Windows8Api.JetResizeDatabase(sesid, dbid, 0, out actualPagesAfterTrim, ResizeDatabaseGrbit.None); EseInteropTestHelper.ConsoleWriteLine("actualPagesAfterTrim is {0}.", actualPagesAfterTrim); Assert.IsTrue(actualPagesAfterTrim < actualPages, "Database didn't shrink!"); int databaseSizeOnDiskInPages; Api.JetGetDatabaseInfo(sesid, dbid, out databaseSizeOnDiskInPages, Windows81DbInfo.FilesizeOnDisk); EseInteropTestHelper.ConsoleWriteLine("databaseSizeOnDiskInPages is {0}.", databaseSizeOnDiskInPages); Assert.AreEqual(actualPagesAfterTrim, databaseSizeOnDiskInPages); } finally { Api.JetTerm(instance); Cleanup.DeleteDirectoryWithRetry(dir); } }
public void Setup() { // we just need a session so don't do any logging or create a database this.instance = SetupHelper.CreateNewInstance("."); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref this.instance); }
public void Teardown() { Api.JetCloseTable(this.sesid, this.tableid); Api.JetEndSession(this.sesid, EndSessionGrbit.None); Api.JetTerm(this.instance); Cleanup.DeleteDirectoryWithRetry(this.directory); SetupHelper.CheckProcessForInstanceLeaks(); }
public void CreateIndexesOnVista() { if (!EsentVersion.SupportsVistaFeatures) { return; } string directory = SetupHelper.CreateRandomDirectory(); string database = Path.Combine(directory, "test.db"); using (var instance = new Instance("VistaCreateindexes")) { instance.Parameters.Recovery = false; instance.Parameters.NoInformationEvent = true; instance.Parameters.MaxTemporaryTables = 0; instance.Parameters.TempDirectory = directory; instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase(session, database, string.Empty, out dbid, CreateDatabaseGrbit.None); using (var transaction = new Transaction(session)) { JET_TABLEID tableid; Api.JetCreateTable(session, dbid, "table", 0, 100, out tableid); JET_COLUMNID columnid; Api.JetAddColumn( session, tableid, "column1", new JET_COLUMNDEF { coltyp = JET_coltyp.Long }, null, 0, out columnid); var indexcreates = new[] { new JET_INDEXCREATE { szKey = "+column1\0", cbKey = 10, szIndexName = "index1", pidxUnicode = new JET_UNICODEINDEX { lcid = 1033 }, }, }; Api.JetCreateIndex2(session, tableid, indexcreates, indexcreates.Length); transaction.Commit(CommitTransactionGrbit.LazyFlush); } } } Cleanup.DeleteDirectoryWithRetry(directory); }
public void InitAndTermOneInstanceAbruptly() { JET_INSTANCE instance = SetupHelper.CreateNewInstance("instance"); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref instance); Api.JetTerm2(instance, TermGrbit.Abrupt); }
public void JetInstanceThrowsExceptionWhenInstanceIsClosed() { var instance = new Instance("closed"); SetupHelper.SetLightweightConfiguration(instance); instance.Init(); instance.Term(); JET_INSTANCE x = instance.JetInstance; }
public void Setup() { Thread.CurrentThread.Priority = ThreadPriority.Highest; this.directory = SetupHelper.CreateRandomDirectory(); this.random = new Random(); this.data = Any.BytesOfLength(DataSize); this.dataBuf = new byte[DataSize]; JET_DBID dbid; string ignored; Api.JetGetSystemParameter( JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, ref this.cacheSizeMinSaved, out ignored, 0); Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, 16384, null); this.instance = new Instance("SimplePerfTest"); this.instance.Parameters.LogFileDirectory = this.directory; this.instance.Parameters.SystemDirectory = this.directory; this.instance.Parameters.MaxVerPages = 1024; this.instance.Parameters.Recovery = false; // Create the instance, database and table this.instance.Init(); this.session = new Session(this.instance); Api.JetCreateDatabase(this.session, Path.Combine(this.directory, "esentperftest.db"), string.Empty, out dbid, CreateDatabaseGrbit.None); // Create a dummy table to force the database to grow using (var trx = new Transaction(this.session)) { JET_TABLEID tableid; Api.JetCreateTable(this.session, dbid, "dummy_table", 64 * 1024 * 1024 / SystemParameters.DatabasePageSize, 100, out tableid); Api.JetCloseTable(this.session, tableid); Api.JetDeleteTable(this.session, dbid, "dummy_table"); trx.Commit(CommitTransactionGrbit.LazyFlush); } // Create the table using (var trx = new Transaction(this.session)) { JET_TABLEID tableid; var columndef = new JET_COLUMNDEF(); Api.JetCreateTable(this.session, dbid, "table", 0, 100, out tableid); columndef.coltyp = JET_coltyp.Currency; Api.JetAddColumn(this.session, tableid, "Key", columndef, null, 0, out this.columnidKey); columndef.coltyp = JET_coltyp.Binary; Api.JetAddColumn(this.session, tableid, "Data", columndef, null, 0, out this.columnidData); Api.JetCreateIndex(this.session, tableid, "primary", CreateIndexGrbit.IndexPrimary, "+key\0\0", 6, 100); Api.JetCloseTable(this.session, tableid); trx.Commit(CommitTransactionGrbit.None); } this.table = new Table(this.session, dbid, "table", OpenTableGrbit.None); }
public void Setup() { this.directory = SetupHelper.CreateRandomDirectory(); this.random = new Random(); JET_DBID dbid; string ignored; Api.JetGetSystemParameter( JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, ref this.cacheSizeMinSaved, out ignored, 0); Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, 16384, null); this.instance = new Instance(Guid.NewGuid().ToString(), "SimplePerfTest"); this.instance.Parameters.LogFileDirectory = this.directory; this.instance.Parameters.SystemDirectory = this.directory; this.instance.Parameters.MaxVerPages = 1024; this.instance.Parameters.Recovery = false; // Create the instance, database and table this.instance.Init(); this.session = new Session(this.instance); this.database = Path.Combine(this.directory, "esentperftest.db"); Api.JetCreateDatabase(this.session, this.database, string.Empty, out dbid, CreateDatabaseGrbit.None); // Create a dummy table to force the database to grow using (var trx = new Transaction(this.session)) { JET_TABLEID tableid; Api.JetCreateTable(this.session, dbid, "dummy_table", 64 * 1024 * 1024 / SystemParameters.DatabasePageSize, 100, out tableid); Api.JetCloseTable(this.session, tableid); Api.JetDeleteTable(this.session, dbid, "dummy_table"); trx.Commit(CommitTransactionGrbit.LazyFlush); } // Create the table using (var trx = new Transaction(this.session)) { JET_COLUMNID columnid; JET_TABLEID tableid; var columndef = new JET_COLUMNDEF(); Api.JetCreateTable(this.session, dbid, TableName, 0, 100, out tableid); columndef.coltyp = JET_coltyp.Currency; Api.JetAddColumn(this.session, tableid, KeyColumnName, columndef, null, 0, out columnid); columndef.coltyp = JET_coltyp.Binary; Api.JetAddColumn(this.session, tableid, DataColumnName, columndef, null, 0, out columnid); Api.JetCreateIndex(this.session, tableid, IndexName, CreateIndexGrbit.IndexPrimary, "+key\0\0", 6, 100); Api.JetCloseTable(this.session, tableid); trx.Commit(CommitTransactionGrbit.None); } // Reset the key for the worker thread PerfTestWorker.NextKey = 0; }
public void Setup() { this.instance = SetupHelper.CreateNewInstance("."); // turn off logging so initialization is faster Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref this.instance); Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty); }
public void Setup() { this.directory = SetupHelper.CreateRandomDirectory(); this.instance = SetupHelper.CreateNewInstance(this.directory); // turn off logging so initialization is faster Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref this.instance); }
public void Setup() { Cleanup.DeleteDirectoryWithRetry(TestDirectory); Directory.CreateDirectory(TestDirectory); this.testInstance = new Instance("HowDoI"); SetupHelper.SetLightweightConfiguration(this.testInstance); this.testInstance.Init(); this.testSession = new Session(this.testInstance); Api.JetCreateDatabase(this.testSession, TestDatabase, null, out this.testDbid, CreateDatabaseGrbit.OverwriteExisting); }
public void ApiThrowsArgumentExceptionOnUnmappableChar() { string directory = SetupHelper.CreateRandomDirectory(); string database = Path.Combine(directory, "test.db"); using (var instance = new Instance("Windows7Createindexes")) { instance.Parameters.Recovery = false; instance.Parameters.NoInformationEvent = true; instance.Parameters.MaxTemporaryTables = 0; instance.Parameters.TempDirectory = directory; instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase(session, database, string.Empty, out dbid, CreateDatabaseGrbit.None); using (var transaction = new Transaction(session)) { JET_TABLEID tableid; Api.JetCreateTable(session, dbid, "table", 0, 100, out tableid); JET_COLUMNID columnid; try { Api.JetAddColumn( session, tableid, "한글", new JET_COLUMNDEF { coltyp = JET_coltyp.Long }, null, 0, out columnid); Assert.Fail("An exception should have been thrown!"); } #if MANAGEDESENT_SUPPORTS_ANSI // The ArgumentException is thrown by the marshalling layer. catch (ArgumentException) { } #else // What's the more precise error code to catch? catch (Microsoft.Isam.Esent.EsentException) { } #endif transaction.Commit(CommitTransactionGrbit.LazyFlush); } } } Cleanup.DeleteDirectoryWithRetry(directory); }
public void Setup() { this.instance = new Instance(Guid.NewGuid().ToString(), "TempTableFixture"); this.instance.Parameters.Recovery = false; this.instance.Parameters.PageTempDBMin = SystemParameters.PageTempDBSmallest; this.instance.Parameters.NoInformationEvent = true; this.instance.Init(); this.session = new Session(this.instance); this.columnDict = SetupHelper.CreateTempTableWithAllColumns(this.session, TempTableGrbit.None, out this.tableid); }
public void Setup() { this.directory = SetupHelper.CreateRandomDirectory(); this.instance = SetupHelper.CreateNewInstance(this.directory); // turn off logging so initialization is faster Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetInit(ref this.instance); Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty); this.tableid = JET_TABLEID.Nil; }
public void CreateIndexesOnXp() { string directory = SetupHelper.CreateRandomDirectory(); string database = Path.Combine(directory, "test.db"); using (var instance = new Instance("XpCompatability")) { instance.Parameters.Recovery = false; instance.Parameters.NoInformationEvent = true; instance.Parameters.PageTempDBMin = SystemParameters.PageTempDBSmallest; instance.Parameters.TempDirectory = directory; instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase(session, database, String.Empty, out dbid, CreateDatabaseGrbit.None); using (var transaction = new Transaction(session)) { JET_TABLEID tableid; Api.JetCreateTable(session, dbid, "table", 0, 100, out tableid); JET_COLUMNID columnid; Api.JetAddColumn( session, tableid, "column1", new JET_COLUMNDEF { coltyp = JET_coltyp.Long }, null, 0, out columnid); var indexcreates = new[] { new JET_INDEXCREATE { szKey = "+column1\0", cbKey = 10, szIndexName = "index1", pidxUnicode = new JET_UNICODEINDEX { lcid = 1033 }, }, }; Api.JetCreateIndex2(session, tableid, indexcreates, indexcreates.Length); transaction.Commit(CommitTransactionGrbit.LazyFlush); } } } Directory.Delete(directory, true); }
public void Setup() { this.directory = SetupHelper.CreateRandomDirectory(); this.database = Path.Combine(this.directory, "database.edb"); this.instance = SetupHelper.CreateNewInstance(this.directory); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetInit(ref this.instance); Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty); Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None); }
/// <summary> /// Resets the cache for the database. /// </summary> private void ResetCache() { Api.JetCloseTable(this.sesid, this.tableid); Api.JetEndSession(this.sesid, EndSessionGrbit.None); Api.JetTerm(this.instance); this.instance = SetupHelper.CreateNewInstance(this.directory); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref this.instance); Api.JetBeginSession(this.instance, out this.sesid, string.Empty, string.Empty); Api.JetAttachDatabase(this.sesid, this.database, AttachDatabaseGrbit.None); Api.JetOpenDatabase(this.sesid, this.database, null, out this.dbid, OpenDatabaseGrbit.None); Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid); }
public void Setup() { this.directory = SetupHelper.CreateRandomDirectory(); this.instance = SetupHelper.CreateNewInstance(this.directory); // turn off logging so initialization is faster Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.PageTempDBMin, SystemParameters.PageTempDBSmallest, null); Api.JetInit(ref this.instance); Api.JetBeginSession(this.instance, out this.sesid, string.Empty, string.Empty); this.columnidDict = SetupHelper.CreateTempTableWithAllColumns(this.sesid, TempTableGrbit.None, out this.tableid); }
public void TestJetConfigureProcessForCrashDump() { if (!EsentVersion.SupportsWindows7Features) { return; } using (var instance = new Instance("TestJetConfigureProcessForCrashDump")) { SetupHelper.SetLightweightConfiguration(instance); instance.Init(); Windows7Api.JetConfigureProcessForCrashDump(CrashDumpGrbit.Maximum); } }
public void CreateUsingDatabaseFilename() { string directory = SetupHelper.CreateRandomDirectory(); string db = Path.Combine(directory, DatabaseObjectTests.DbName); using (this.database = new Database(db)) { Assert.AreNotEqual(this.database.InstanceHandle, JET_INSTANCE.Nil); } #if !MANAGEDESENT_ON_WSA Assert.IsTrue(File.Exists(db)); Assert.IsTrue(File.Exists(Path.Combine(directory, this.edbLogFileName))); #endif }
public void CreateInstanceInitTerm() { string dir = SetupHelper.CreateRandomDirectory(); using (var instance = new Instance("theinstance")) { instance.Parameters.LogFileDirectory = dir; instance.Parameters.SystemDirectory = dir; instance.Parameters.TempDirectory = dir; instance.Parameters.NoInformationEvent = true; instance.Init(); instance.Term(); Directory.Delete(dir, true); // only works if the instance is terminated } }
public void InitAndTermTwoInstances() { JET_INSTANCE instance1 = SetupHelper.CreateNewInstance("instance1"); Api.JetSetSystemParameter(instance1, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(instance1, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); JET_INSTANCE instance2 = SetupHelper.CreateNewInstance("instance2"); Api.JetSetSystemParameter(instance2, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetSetSystemParameter(instance2, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null); Api.JetInit(ref instance1); Api.JetInit(ref instance2); Api.JetTerm(instance1); Api.JetTerm(instance2); }
public void InitAndTermOneInstanceAbruptly() { string dir = SetupHelper.CreateRandomDirectory(); try { JET_INSTANCE instance = SetupHelper.CreateNewInstance(dir); Api.JetInit(ref instance); Api.JetTerm2(instance, TermGrbit.Abrupt); } finally { Directory.Delete(dir, true); } }
public void CreateDatabase2WithAsciiPath() { using (var instance = new Instance("asciidbcreate")) { SetupHelper.SetLightweightConfiguration(instance); instance.Parameters.CreatePathIfNotExist = true; instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase2(session, this.database, 1024, out dbid, CreateDatabaseGrbit.None); Assert.IsTrue(File.Exists(this.database)); } } }
public void CreateUsingInitializedInstance() { string directory = SetupHelper.CreateRandomDirectory(); string db = Path.Combine(directory, DatabaseObjectTests.DbName); JET_INSTANCE instance; JET_SESID sesid; JET_DBID dbid; instance = SetupHelper.CreateNewInstance(directory); Api.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.Recovery, 0, "off"); Api.JetInit(ref instance); Api.JetBeginSession(instance, out sesid, string.Empty, string.Empty); Api.JetCreateDatabase(sesid, db, string.Empty, out dbid, CreateDatabaseGrbit.None); Api.JetCloseDatabase(sesid, dbid, CloseDatabaseGrbit.None); Api.JetEndSession(sesid, EndSessionGrbit.None); var engineConfig = new DatabaseConfig() { DatabaseFilename = db, }; using (this.database = new Database(instance, false, engineConfig)) { Assert.AreNotEqual(this.database.InstanceHandle, JET_INSTANCE.Nil); Assert.AreEqual(this.database.Config.Recovery, "off"); } using (this.database = new Database(instance, true, engineConfig)) { Assert.AreNotEqual(this.database.InstanceHandle, JET_INSTANCE.Nil); Assert.AreEqual(this.database.Config.Recovery, "off"); } try { Api.JetTerm(instance); Assert.Fail("EsentInvalidInstanceException expected !"); } // ISSUE-2014/10/28-UmairA - Debug build returns InvalidInstance, retail returns InvalidParameter. JetTerm() should be fixed. catch (EsentInvalidInstanceException) { } catch (EsentInvalidParameterException) { } }
public void DetachDatabaseWithAsciiPath() { using (var instance = new Instance("asciidbdetach")) { SetupHelper.SetLightweightConfiguration(instance); instance.Parameters.CreatePathIfNotExist = true; instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase(session, this.database, string.Empty, out dbid, CreateDatabaseGrbit.None); Api.JetCloseDatabase(session, dbid, CloseDatabaseGrbit.None); Api.JetDetachDatabase(session, this.database); } } }