Skip to content

Latest commit

 

History

History
83 lines (55 loc) · 1.86 KB

File metadata and controls

83 lines (55 loc) · 1.86 KB

Birko.Data.JSON

JSON file-based storage implementation for the Birko Framework. Good reference for understanding store patterns.

Features

  • File-based data persistence (no database required)
  • Sync and async stores with bulk operations
  • Thread-safe file access with locking
  • Human-readable JSON data files
  • Auto-save on every operation

Installation

dotnet add package Birko.Data.JSON

Dependencies

  • Birko.Data.Core (AbstractModel)
  • Birko.Data.Stores (store interfaces, Settings)
  • System.Text.Json

Usage

using Birko.Data.JSON.Stores;

var store = new JsonStore<Customer>("data/customers.json");

// Create
var id = store.Create(new Customer { Name = "John Doe" });

// Read
var customer = new Customer { Id = id };
store.Read(customer);

// Update
customer.Name = "Jane Doe";
store.Update(customer);

// Read all
var customers = store.ReadAll();

// Delete
store.Delete(customer);

Settings

var settings = new JsonSettings { FilePath = "data/customers.json" };
store.SetSettings(settings);

API Reference

Stores

  • JsonStore<T> - Sync JSON file store
  • JsonBulkStore<T> - Bulk operations
  • AsyncJsonStore<T> - Async store
  • AsyncJsonBulkStore<T> - Async bulk store

Repositories

  • JsonRepository<T> / JsonBulkRepository<T>
  • AsyncJsonRepository<T> / AsyncJsonBulkRepository<T>

Related Projects

Filter-Based Bulk Operations

Supports filter-based update and delete via default read-modify-save pattern inherited from AbstractBulkStore (file-based storage has no native filter-based bulk operations).

License

Part of the Birko Framework.