All Projects → Reshiru → Blazor.indexeddb.framework

Reshiru / Blazor.indexeddb.framework

Licence: mit
A framework for blazor which acts as an interface to IndexedDB

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Blazor.indexeddb.framework

Efcore
EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
Stars: ✭ 10,838 (+17380.65%)
Mutual labels:  database, dotnet-standard
Entityframeworkcore.cacheable
EntityFrameworkCore second level cache
Stars: ✭ 138 (+122.58%)
Mutual labels:  database, dotnet-standard
Entityframework Extensions
Entity Framework Bulk Operations | Improve Entity Framework performance with Bulk SaveChanges, Insert, update, delete and merge for SQL Server, SQL Azure, SQL Compact, MySQL and SQLite.
Stars: ✭ 215 (+246.77%)
Mutual labels:  database, dotnet-standard
Interference
opensource distributed database with base JPA implementation and event processing support
Stars: ✭ 57 (-8.06%)
Mutual labels:  database
Docker Backup Database
Docker image to periodically backup your database (MySQL, Postgres, or MongoDB) to S3 or local disk.
Stars: ✭ 57 (-8.06%)
Mutual labels:  database
Restfeel
RESTFeel: 一个企业级的API管理&测试平台。RESTFeel帮助你设计、开发、测试您的API。
Stars: ✭ 59 (-4.84%)
Mutual labels:  database
Lifti
A lightweight full text indexer for .NET
Stars: ✭ 61 (-1.61%)
Mutual labels:  dotnet-standard
Nodbi
Document DBI connector for R
Stars: ✭ 56 (-9.68%)
Mutual labels:  database
Layr
Dramatically simplify full‑stack development
Stars: ✭ 1,111 (+1691.94%)
Mutual labels:  database
Sql.js
A javascript library to run SQLite on the web.
Stars: ✭ 9,594 (+15374.19%)
Mutual labels:  database
Dolt
Dolt – It's Git for Data
Stars: ✭ 9,880 (+15835.48%)
Mutual labels:  database
Couchbase Lite C
C language bindings for the Couchbase Lite embedded NoSQL database engine
Stars: ✭ 58 (-6.45%)
Mutual labels:  database
Data Science Best Resources
Carefully curated resource links for data science in one place
Stars: ✭ 1,104 (+1680.65%)
Mutual labels:  database
Bulwark Explorer
Block explorer for Bulwark Cryptocurrency
Stars: ✭ 57 (-8.06%)
Mutual labels:  database
Skunk
A data access library for Scala + Postgres.
Stars: ✭ 1,107 (+1685.48%)
Mutual labels:  database
Assassin
Assassin is a decentralized database that uses background threads to kill slow JavaScript.
Stars: ✭ 57 (-8.06%)
Mutual labels:  database
Neo4j Graphql
An optimized neo4j query resolver for Facebook's GraphQL
Stars: ✭ 60 (-3.23%)
Mutual labels:  database
Noisepage
Self-Driving Database Management System from Carnegie Mellon University
Stars: ✭ 1,095 (+1666.13%)
Mutual labels:  database
Db Dashboard
Project files of the article featured here: http://db.rstudio.com/best-practices/dashboards/
Stars: ✭ 58 (-6.45%)
Mutual labels:  database
Stackexchange Dump To Postgres
Python scripts to import StackExchange data dump into Postgres DB.
Stars: ✭ 58 (-6.45%)
Mutual labels:  database

ARCHIVED: Blazor.IndexedDB.Framework

An easy way to interact with IndexedDB and make it feel like EFCore but async.

NuGet installation

PM> Install-Package Reshiru.Blazor.IndexedDB.Framework

Current features

  • Connect and create database
  • Add record
  • Remove record
  • Edit record

How to use

  1. In your startup.cs file add
services.AddSingleton<IIndexedDbFactory, IndexedDbFactory>();

IIndexedDbFactory is used to create your database connection and will create the database instance for you. IndexedDbFactory requires an instance IJSRuntime, should normally already be registered.

  1. Create any code first database model you'd like to create and inherit from IndexedDb. (Only properties with the type IndexedSet<> will be used, any other properties are beeing ignored)
public class ExampleDb : IndexedDb
{
  public ExampleDb(IJSRuntime jSRuntime, string name, int version) : base(jSRuntime, name, version) { }
  public IndexedSet<Person> People { get; set; }
}
  • Your model (eg. person) should contain an Id property or a property marked with the key attribute.
public class Person
{
  [System.ComponentModel.DataAnnotations.Key]
  public long Id { get; set; }
  public string FirstName { get; set; }
  public string LastName { get; set; }
}
  1. Now you can start using your database. (Usage in razor via inject: @inject IIndexedDbFactory DbFactory)

Adding records

using (var db = await this.DbFactory.Create<ExampleDb>())
{
  db.People.Add(new Person()
  {
    FirstName = "First",
    LastName = "Last"
  });
  await db.SaveChanges();
}

Removing records

Note: To remove an element it is faster to use a already created reference. You should be able to also remove an object only by it's id but you have to use the .Remove(object) method (eg. .Remove(new object() { Id = 1 }))

using (var db = await this.DbFactory.Create<ExampleDb>())
{
  var firstPerson = db.People.First();
  db.People.Remove(firstPerson);
  await db.SaveChanges();
}

Modifying records

using (var db = await this.DbFactory.Create<ExampleDb>())
{
  var personWithId1 = db.People.Single(x => x.Id == 1);
  personWithId1.FirstName = "This is 100% a first name";
  await db.SaveChanges();
}

License

Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].