IdbDatabase Class

A connection to a database (https://w3c.github.io/IndexedDB/#idbdatabase).

public sealed class IdbDatabase : EventTarget
Inheritance
EventTarget IdbDatabase

Properties

NameDescription
NameGets the name of the database.
ObjectStoreNamesGets the sorted names of the object stores of the connection.
OnAbortThe event handler of the abort events.
OnCloseThe event handler of the close events.
OnErrorThe event handler of the error events.
OnVersionChangeThe event handler of the versionchange events.
VersionGets the version of the connection.

Gets the name of the database.

public string Name { get; }

ObjectStoreNames

IdbDatabase.cs

Gets the sorted names of the object stores of the connection.

public DomStringList ObjectStoreNames { get; }

The event handler of the abort events.

public Action<Event>? OnAbort { get; set; }

The event handler of the close events.

public Action<Event>? OnClose { get; set; }

The event handler of the error events.

public Action<Event>? OnError { get; set; }

OnVersionChange

IdbDatabase.cs

The event handler of the versionchange events.

public Action<Event>? OnVersionChange { get; set; }

Gets the version of the connection.

public ulong Version { get; }

Methods

NameDescription
Close()Closes the connection once its transactions are finished (https://w3c.github.io/IndexedDB/#dom-idbdatabase-close).
CreateObjectStore(string, IdbObjectStoreParameters?)Creates an object store in the upgrade transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-createobjectstore).
DeleteObjectStore(string)Deletes an object store in the upgrade transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-deleteobjectstore).
Transaction(object?, IdbTransactionMode, IdbTransactionOptions?)Creates a transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction).

Closes the connection once its transactions are finished (https://w3c.github.io/IndexedDB/#dom-idbdatabase-close).

public void Close()

CreateObjectStore(string, IdbObjectStoreParameters?)

IdbDatabase.cs

Creates an object store in the upgrade transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-createobjectstore).

public IdbObjectStore CreateObjectStore(string name, IdbObjectStoreParameters? options = null)

DeleteObjectStore(string)

IdbDatabase.cs

Deletes an object store in the upgrade transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-deleteobjectstore).

public void DeleteObjectStore(string name)

Transaction(object?, IdbTransactionMode, IdbTransactionOptions?)

IdbDatabase.cs

Creates a transaction (https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction).

public IdbTransaction Transaction(object? storeNames, IdbTransactionMode mode = IdbTransactionMode.ReadOnly, IdbTransactionOptions? options = null)

Parameters

storeNames object?
The name of an object store, or a list of names.
mode IdbTransactionMode
The mode of the transaction: IdbTransactionMode.ReadOnly or IdbTransactionMode.ReadWrite.
options IdbTransactionOptions?
The options of the transaction.

Returns

IdbTransaction

See also