Class ScriptableRepository<T>
A concrete implementation of IRepository that uses an IDatabaseContext to persist and retrieve entities. Assumes that entities implement IPrimaryKey with an integer key.
public class ScriptableRepository<T> : IRepository<T> where T : class, IPrimaryKey<int>, new()
Type Parameters
| Name | Type | Description |
|---|---|---|
T | The type of the entity managed by this repository. Must be a class, implement IPrimaryKey, and have a parameterless constructor. |
Inheritance
Implements
Constructors
ScriptableRepository(IDatabaseContext)
Initializes a new instance of the ScriptableRepository class.
public ScriptableRepository(IDatabaseContext context)
Parameters
| Name | Type | Description |
|---|---|---|
context | IDatabaseContext | The database context to use for data operations. |
Methods
Delete(T)
Deletes the specified entity from the database.
public void Delete(T entity)
Parameters
| Name | Type | Description |
|---|---|---|
entity | T | The entity to delete. |