Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kirill22012002/jsonasdatastorage
JSON as Data Storage. For example caching data to json. Or for simple project use json as Data Storage
https://github.com/kirill22012002/jsonasdatastorage
c-sharp dotnet json newtonsoft-json
Last synced: 1 day ago
JSON representation
JSON as Data Storage. For example caching data to json. Or for simple project use json as Data Storage
- Host: GitHub
- URL: https://github.com/kirill22012002/jsonasdatastorage
- Owner: Kirill22012002
- Created: 2024-09-17T08:02:38.000Z (10 days ago)
- Default Branch: develop
- Last Pushed: 2024-09-24T09:54:31.000Z (3 days ago)
- Last Synced: 2024-09-26T00:02:49.489Z (1 day ago)
- Topics: c-sharp, dotnet, json, newtonsoft-json
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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);```