DbContextSCope package for EF6 and EFCore. Forked from https://github.com/mehdime/DbContextScope. Compatible with .net 4.0+ (EF6) and .net Standard 1.3+ (EFCore). Credit also to https://github.com/ninety7 for code regarding refreshing parent entities.
Manage your DbContexts the right way.
The persistence layer or infrastructure layer uses the DbContext (e.g. from a repository). Controlling its scope and transaction lifetime, however, is ideally the reponsibility of...