Multiple UnitOfWork

Nov 9, 2016 at 7:42 PM
First I would like to say thank you for all of your hard work in creating this awesome Framework.

I have been using URF in a MVC intranet website and part of this is to load data from our ERP system into an employee portal. The data sets that are getting imported into the website have recently been evolving, a lot. So for the time being (maybe for ever) I'm implementing an auditor for some of my entities. I have already wrote the code to link into the Update, Insert and Delete service functions to record the changes into audit tables. I have decided to record the details of the changes; type: insert, update, delete; success: pass or fail; all the fields that have changed in a json string, and some other metadata. Since I want this audit to be saved to the same database even if there is a DB error I know I need a separate UnitOfWork for the auditor. Do I need a separate DataContext too or can the two UnitOfWorks use the same DataContext?

I don't think it really matters but I'm using Unity with PerRequestLifetimeManager. For right now I have a controller that I am using to call the data sync but I will be hoping to move this to getting handled by a job with Hangfire.