You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

QuickDBS.WebDB

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

QuickDBS.WebDB

A tiny library which acts as ORM between Blazor WebAssembly and Browser LocalStorage

0.0.1
nugetNuGet
Version published
Maintainers
1
Created
Source

WebDB example

WebDB uses the browsers LocalStorage to perform CRUD operations from client's Blazor WebAssembly project using similar methods as available in other QuickDBS ORM libraries such as SQLServer, MySQL or SQLite.

var db = new QuickDBS.WebDB("MyProject", InstanceOfJSRuntime);

We will use the following Person class example for demonstrating the use of WebDB.

public class Person
{
    public Int64 Id { get; set; }
    public string Name { get; set; }
    public double Income { get; set; }
    public DateTime DateOfBirth { get; set; }
}

Create a Person record in the Person collection. The result will be the last insert Id of the collection which will be unique.

var id = await db.Create<Person>(new Person {
  Name = "Rahul",
  Income = 5000,
  DateOfBirth = new DateTime(2000, 01, 01)
});

Get the person record having Id = 1 from the Person collection.

var person = await db.GetById<Person>(1);
person.Name = "Rahul Hadgal";
person.Income = 10000;

Update the income for person selected in the above example, from 5000 to 10000 and change name to Full Name.

var result = await db.UpdateById<Person>(person);

Get all records from Person collection

var people = await db.GetAll<Person>();

Delete a person by Id = 1 from the Person collection.

var result = await db.DeleteById<Person>(1);

Keywords

FAQs

Package last updated on 17 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.