ASP.NET website recommends implementing Disposable on my repository which affects my datacontext.
Is it sufficient for me to initialize the datacontext here, and casually let ASP.NET dispose of the resources?
Under what conditions will it not get called? I am debugging frequently (ending the debug session mid page) and noticed that I needed to reboot to reclaim some memory.
MVC will not dispose any
IDisposableinstances you create. You are in-charge of disposing them. You can either over rideDisposemethod of the controller.Or use a Dependency Injection/IoC framework to control the lifetime of the
IDisposableinstances. Many DI/IoC frameworks will automatically call theDisposemethod if the framework created those instances.