Tavenem.Blazor.IndexedDB
6.4.1
Prefix Reserved
See the version list below for details.
dotnet add package Tavenem.Blazor.IndexedDB --version 6.4.1
NuGet\Install-Package Tavenem.Blazor.IndexedDB -Version 6.4.1
<PackageReference Include="Tavenem.Blazor.IndexedDB" Version="6.4.1" />
<PackageVersion Include="Tavenem.Blazor.IndexedDB" Version="6.4.1" />
<PackageReference Include="Tavenem.Blazor.IndexedDB" />
paket add Tavenem.Blazor.IndexedDB --version 6.4.1
#r "nuget: Tavenem.Blazor.IndexedDB, 6.4.1"
#:package Tavenem.Blazor.IndexedDB@6.4.1
#addin nuget:?package=Tavenem.Blazor.IndexedDB&version=6.4.1
#tool nuget:?package=Tavenem.Blazor.IndexedDB&version=6.4.1
Tavenem.Blazor.IndexedDB
Tavenem.Blazor.IndexedDB is a Razor class library (RCL) containing a Razor component. It grants managed access to the IndexedDB API.
It uses the idb javascript library by Jake Archibald, and implements the IDataStore interface from the Tavenem DataStore library.
Installation
Tavenem.Blazor.IndexedDB is available as a NuGet package.
Use
Register the
IndexedDbServicewith dependency injection.builder.Services.AddIndexedDbService();Register one or more
IndexedDbinstances with dependency injection.// simple builder.Services.AddIndexedDb("myDatabaseName"); // all options builder.Services.AddIndexedDb( databaseName: "myDatabaseName", // the database name objectStores: ["valueStore"], // the names of value stores version: 2, // the version number of the current database schema jsonSerializerOptions: new(JsonSerializerDefaults.Web), // a JsonSerializerOptions instance key: "id"); // the name of the property to use as the primary key in stored objectsNote that use of dependency injection for database instances is optional. They can also be initialized on demand with their public constructor, which requires an instance of
IndexedDbService.Inject an
IndexedDbinstance in a component.[Inject(Key = "myDatabaseName")] private IndexedDb MyDatabase { get; set; } = default!;Note that the
@injectdirective does not currently support keyed services.Retrieve an
IndexedDbStoreinstance by name.var store = MyDatabase["valueStore"];Call the
StoreItemAsync<T>,GetItemAsync<T>, andRemoveItemAsync<T>methods on anIndexedDbStoreto work with strongly-typed data items.class Item : IIdItem { public string Id { get; set; } public string? Value { get; set; } } var item = new Item { Id = "1", Value = "Hello, World!", }; await store.StoreItemAsync(item); item.Value = "Goodbye!"; await store.StoreItemAsync(item); var fetchedItem = await store.GetItemAsync<Item>(item.Id); // fetchedItem is an Item instance: item.Value == "Goodbye!" await store.RemoveItemAsync(item); fetchedItem = await store.GetItemAsync<Item>(item.Id); // fetchedItem is nullCall the
Query<T>method to obtain anIDataStoreQueryable<T>.IDataStoreQueryable<T>is similar toIQueryable<T>, and can be used to make queries against the data source.await foreach (var item in store.Query<Item>().AsAsyncEnumerable()) { Console.WriteLine(item.Value); } var helloCount = await store .Query<Item>() .Select(x => x.Value != null && x.Value.Contains("Hello")) .CountAsync();Call the
ClearAsync,CountAsync, andGetAllAsync<T>methods to work with the full object store.await store.StoreItemAsync(item); var count = await store.CountAsync(); // count = 1 var items = await store.GetAllAsync<Item>(); // items is an array of Items with Length 1 await store.ClearAsync(); count = await store.CountAsync(); // count = 0Call the
DeleteDatabaseAsyncmethod on theIndexedDbinstance to remove the entire database.await MyDatabase.DeleteDatabaseAsync(); // the database has been removed (or will be, after all connections are closed)
Roadmap
New versions of Tavenem.IndexedDb should be expected whenever the API surface of the Tavenem DataStore library receives an update.
Other updates to resolve bugs or add new features may occur at any time.
Contributing
Contributions are always welcome. Please carefully read the contributing document to learn more before submitting issues or pull requests.
Code of conduct
Please read the code of conduct before engaging with our community, including but not limited to submitting or replying to an issue or pull request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.18)
- Tavenem.DataStore (>= 2.0.4)
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.9)
- Tavenem.DataStore (>= 2.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Tavenem.Blazor.IndexedDB:
| Package | Downloads |
|---|---|
|
H.Necessaire.Runtime.UI.Razor
A Core Framework for Rapid Application Development |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.6-preview-0003 | 305 | 9/17/2025 |
| 7.0.5-preview-0001 | 170 | 8/11/2025 |
| 7.0.3-preview-0002 | 155 | 8/14/2025 |
| 6.4.1 | 5,894 | 9/17/2025 |
| 6.3.4 | 1,330 | 7/31/2025 |
| 6.2.5 | 231 | 7/30/2025 |
| 6.1.5 | 676 | 7/23/2025 |
| 6.0.6 | 526 | 6/24/2025 |
| 5.1.4 | 1,248 | 1/24/2025 |
| 5.0.2 | 538 | 12/27/2024 |
| 4.2.4 | 308 | 12/17/2024 |
| 4.1.4 | 403 | 11/21/2024 |
| 4.0.2 | 1,550 | 6/30/2024 |
| 3.0.2 | 952 | 3/20/2024 |
| 2.3.4 | 322 | 3/5/2024 |
| 2.2.4 | 285 | 2/12/2024 |
| 2.1.2 | 316 | 11/29/2023 |
| 2.0.1 | 238 | 11/27/2023 |
| 1.0.0 | 851 | 12/8/2021 |