Sep 18, 2018 01:49 AM|akhilrajau|LINK
I can understand that, if we implement Dependency Injection disposing is not our responsibility. IOC container will do
that for us.
Ok. Based on code i understand that the developer who developed this, followed some blog and tries to implement DI. So he makes this Basev1Controller etc. But i Don't know why he din't implemented DI. So he also skipped disposing of object.
So that my confusion is then why he override Dispose method in BaseV1Controller? May be add this after skipped DI pattern. Also we need to include _db.Dispose() also in this method. correct?
Thanks for the explanation and guidance for Repository/ I will look into DAO pattern. Existing implementation looks like this so i don't want to chnage all. I will improve one by one.
Currently i cannot extend this repository classes due to the generic interface. So my plan is to do the following
This will help me to extend the repository related methods. Hence avoid linq and other data access codes from Controller.
Based on this aim, we need to implement IDisposable in the interface? Also include dispose in repository as we are not implement IOC now?