database-repository

Implement a JSON-backed repository pattern with DataContext and PersistenceSession.

Updated Jan 7, 2026
One-click install
npx skills add https://github.com/erymuzuan/motorent --skill database-repository
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-repository
Source: https://github.com/erymuzuan/motorent/tree/main/.copilot/skills/database-repository
Command: npx skills add https://github.com/erymuzuan/motorent --skill database-repository

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Custom repository pattern and DataContext implementation for JSON-based storage with computed columns.

Core Features & Use Cases

  • Entity base class with WebId and audit fields
  • DataContext with query entry point and IQueryable properties
  • PersistenceSession as Unit of Work for transactional changes
  • Repository pattern enabling CRUD per entity type
  • JSON-based storage with computed columns for fast querying
  • Supports loading, saving, updating, and deleting domain entities via a controlled workflow

Quick Start

Create a RentalDataContext, open a PersistenceSession, attach entities, and call SubmitChanges to persist changes.

Frequently Asked Questions about database-repository

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a repository pattern for JSON storage in my application?

A repository pattern for JSON storage uses a DataContext with IQueryable properties and a PersistenceSession to handle transactional changes. It provides a generic IRepository for CRUD operations on domain entities.

What is the unit-of-work pattern and how does it work with JSON data contexts?

The unit-of-work pattern for JSON data contexts is implemented via a PersistenceSession. You open a session, attach or delete entities, then call SubmitChanges to transactionally persist all modifications to the JSON storage.

Can I use computed columns with JSON-backed repositories for faster querying?

Yes, JSON-backed repositories support computed columns specifically for fast querying. The DataContext provides a CreateQuery entry point allowing you to run queries against computed columns and aggregate domain entities efficiently.

Does this repository pattern require an external database or ORM framework?

No external database or ORM framework is required. The repository pattern operates entirely on JSON-based storage with an Entity base class containing WebId and audit fields, handling data access boilerplate without external dependencies.

What is the best way to structure CRUD operations for domain entities stored in JSON?

The best way to structure CRUD operations for JSON-stored entities is using a generic IRepository pattern. It enables loading, saving, updating, and deleting domain entities through a controlled workflow managed by the DataContext and PersistenceSession.

When should I avoid using a JSON file repository pattern for data access?

You should avoid a JSON file repository pattern in applications requiring high concurrency, large-scale relational data, or complex transactional integrity across multiple data sources, as JSON storage is optimized for simpler domain entity persistence.