Skip to content

Files

Latest commit

af491af · Sep 30, 2020

History

History

Persistence

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 4, 2020
Sep 4, 2020
Sep 4, 2020
Sep 4, 2020
Sep 30, 2020

Persistence

The persistence folder is a collection of class libraries that utilize the Repository and Unit of Work patterns. In order to use them in a project, they have to be added as dependencies.

Afterwards, in the Startup.cs file of the project, the AddPersistence service has to be added:

//...
public void ConfigureServices(IServiceCollection services)
{
    services.AddPersistence(Configuration);
    services.AddControllersWithViews();
}
//...

Finally in the controller the IUnitOfWork interface has to be injected:

//...
public class HomeController : Controller
{
    private IUnitOfWork _unitOfWork;

    public HomeController(IUnitOfWork unitOfWork)
    {
        _unitOfWork = unitOfWork;
    }
//...