An open API service indexing awesome lists of open source software.

https://github.com/kirill22012002/jsonasdatastorage

JSON file as Data Storage.
https://github.com/kirill22012002/jsonasdatastorage

c-sharp dotnet json newtonsoft-json

Last synced: 3 months ago
JSON representation

JSON file as Data Storage.

Awesome Lists containing this project

README

        

# JsonAsDataStorage

```csharp
public class User
{
public string UserId { get; set; }
public string UserName { get; set; }
}

// init
IBaseStorage userStorage = new BaseStorage(filePath: "users.json", idField: "UserId");

var user = new User
{
UserId = Guid.NewGuid().ToString(),
UserName = "Kirill"
};

// insert new data
await userStorage.InsertItemAsync(user);

// get by id
var result = await userStorage.GetItemAsync(user.UserId);

// update by id
await userStorage.UpdateItemAsync(user.UserId, new User { UserId = user.UserId, UserName = "Alexey" });

// delete by id
await userStorage.DeleteItemAsync(user.UserId);

```