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.
- Host: GitHub
- URL: https://github.com/kirill22012002/jsonasdatastorage
- Owner: Kirill22012002
- Created: 2024-09-17T08:02:38.000Z (10 months ago)
- Default Branch: develop
- Last Pushed: 2024-10-31T04:28:11.000Z (9 months ago)
- Last Synced: 2025-04-12T02:25:03.094Z (3 months ago)
- Topics: c-sharp, dotnet, json, newtonsoft-json
- Language: C#
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
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);```