c# - Default project dependency disposing inconsistency -


after creating new asp.net core project in visual studio 2017 2 controllers: accountcontroller , managecontroller. both controllers use dependency injection via constructors applicationsigninmanager , applicationusermanager.

accountcontroller's dispose:

protected override void dispose(bool disposing) {     if (disposing)     {         if (_usermanager != null)         {             _usermanager.dispose();             _usermanager = null;         }          if (_signinmanager != null)         {             _signinmanager.dispose();             _signinmanager = null;         }     }      base.dispose(disposing); } 

managecontroller's dispose:

protected override void dispose(bool disposing) {     if (disposing && _usermanager != null)     {         _usermanager.dispose();         _usermanager = null;     }      base.dispose(disposing); } 

why doesn't managecontroller dispose sign in manager? why different accountcontroller?

based on juan's comment:

it looks oversight, doesn't matter because ioc container should dispose dependencies it's fine remove dispose methods altogether.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -