-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# BasicRepos | ||
A project to build .NET repository services more quickly | ||
|
||
## Getting Started | ||
|
||
To add Basic Repositories to your service collection simply use `AddBasicRepos<TDbContext>()` on the Service Collection. For example: | ||
|
||
```csharp | ||
builder.Services.AddBasicRepos<MyDbContext>(); | ||
``` | ||
|
||
This will add a repository registration for every `DbSet<T>` on the target `DbContext`. | ||
|
||
> To add support for `DbSet<T>`s in another `DbContext`, simply call `AddBasicRepos<TDbContext>()` again with the second type. | ||
> | ||
> For example: | ||
> | ||
> ```csharp | ||
> builder.Services.AddBasicRepos<MyDbContext>() | ||
> .AddBasicRepos<MyOtherDbContext>(); | ||
> ``` | ||
Using `AddBasicRepos<MyDbContext>()` will register each of the following repository types for each `DbSet<T>`: | ||
- `IRepository<T>`: repository with read and write abilities on the underlying data store, with no cache | ||
- `IReadOnlyRepository<T>`: repository with only the ability to read from the underlying data store | ||
- `ICachedRepository<T>`: repository which wraps an in-memory cache of the items it manages |