<xml></xml>

Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++ Members: Show All Members: Filtered Members: Filtered Members: Filtered

Berkeley DB .NET API Documentation
SecondaryDatabase..::.Close Method
SecondaryDatabase Class See Also

Although closing a database will close any open cursors, it is recommended that applications explicitly close all their Cursor objects before closing the database. The reason why is that when the cursor is explicitly closed, the memory allocated for it is reclaimed; however, this will not happen if you close a database while cursors are still opened.

The same rule, for the same reasons, hold true for Transaction objects. Simply make sure you resolve all your transaction objects before closing your database handle.

Because key/data pairs are cached in memory, applications should make a point to always either close database handles or sync their data to disk (using Sync()()() before exiting, to ensure that any data cached in main memory are reflected in the underlying file system.

When called on a database that is the primary database for a secondary index, the primary database should be closed only after all secondary indices referencing it have been closed.

When multiple threads are using the object concurrently, only a single thread may call the Close method.

The object may not be accessed again after Close is called, regardless of its outcome.

# Overload List

| Name | Description
--- | --- | ---
| Close()()() | Flush any cached database information to disk, close any open Cursor()()() objects, free any allocated resources, and close any underlying files. (Inherited from BaseDatabase.)
| Close(Boolean) | Optionally flush any cached database information to disk, close any open Cursor()()() objects, free any allocated resources, and close any underlying files. (Inherited from BaseDatabase.)

# See Also

SecondaryDatabase Class
SecondaryDatabase Members
BerkeleyDB Namespace