What problem does it solve?
Traditional data access layers often involve repetitive repository boilerplate, N+1 query problems, and complex manual ID management. This Skill eliminates these issues by making entities self-aware and self-persisting, simplifying data operations.
Core Features & Use Cases
- Auto GUID v7 IDs: Entities automatically get chronologically sortable, globally unique IDs without manual intervention.
- Self-Persisting Entities: Use
await entity.Save() and await entity.Remove() directly on entity instances, eliminating the need for separate repositories.
- Efficient Querying: Perform static queries like
await Entity.All(), await Entity.Get(id), and await Entity.Query() with LINQ, supporting batch retrieval to prevent N+1 issues.
- Streaming & Pagination: Handle large datasets efficiently with streaming (
AllStream()) and paginate results for web APIs.
- Use Case: Define a
Product entity, then save it with await product.Save(), retrieve it with await Product.Get(id), and query all active products with await Product.Query(p => p.IsActive), all without writing a single repository class.
Quick Start
To create and save a new 'Todo' item:
var todo = new Todo { Title = "Buy groceries" };
await todo.Save();
To retrieve it by ID:
var loaded = await Todo.Get(todo.Id);