SavageLearning / Machete

A web application for managing a day laborer referral organization. Built using .NET Core MVC, Entity Framework Core, jQuery, Datatables (datatables.net).
GNU General Public License v3.0
17 stars 17 forks source link

Some controllers call multiple service write actions, breaking UnitOfWork pattern #311

Open jcii opened 6 years ago

jcii commented 6 years ago

[ There is greater shame here ]

The Dispose method in machete's unitofwork has always been broken. This is reflected in memory usage, which has been ignored because #features and #life.

The UnitOfWork pattern has been fixed, but now sins are clear. There are instances of Controllers making multiple service write calls and throwing disposed context exceptions.

Known controllers are:

This logic needs to be pushed into the service layer where UoW is controlled. This is expected to permit context disposal to work and memory usage to improve considerably.

jcii commented 6 years ago

searched machete.web/*Controller.ts for if

jcii commented 6 years ago

https://msdn.microsoft.com/en-us/library/ff660872(v=pandp.20).aspx https://ayende.com/blog/3955/repository-is-the-new-singleton https://github.com/mehdime/DbContextScope http://mehdi.me/ambient-dbcontext-in-ef6/