-
Notifications
You must be signed in to change notification settings - Fork 5
Repository
A repository is responsible for storing, clearing and loading test data of entities in the database. Whether Entity Framework or another O/R mapping framework is used depends on the repository. It is not mandatory to store the test data in a database, you can also store it at another place like in a file or in the memory.
The Entity Framework repository is the only one available via Nuget. For more info see Entity Framework Repository.
Implementing custom repositories is as easy as implementing custom data providers. For more info see Custom Repository.
You can set a global repository with the method WithRepository(IRepository repository) which is used globally for all entities.
var config = new CherrySeedConfiguration(cfg =>
{
...
cfg.WithRepository(globalRepository);
...
});
It is also possible to override the global repository for a specific entity. For example, one entity needs special handling before inserting it into the database. For more info see Setting Entity Specific Repository.