Hooking IDbInterceptor to EntityFramework DbContext only once

c# entity-framework entity-framework-6 interceptor logging

Accepted Answer

ZZZ_tmp
8
2/23/2017 4:35:59 PM

Popular Answer

The docs indicates that you may just insert it.Application_Start :

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    DbInterception.Add(new SchoolInterceptorTransientErrors());
    DbInterception.Add(new SchoolInterceptorLogging());
}

The fact that it is only named once is crucial.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow