I will show you how to do lazy db context initialization with Entity Framework 7.
The idea is simple, we need an easy way to get database context in a request. If db context was used in the request we should call SaveChanges method and dispose used context if not we shouldn’t do anything.
#c# #vnext #asp.net 5 #tutorial #ef7