Saving changes to context...

Feb 24, 2016 at 4:12 AM
Edited Feb 24, 2016 at 12:45 PM
Ive been using this framework for quite some time now. I have modified it to fit my own needs and it has served me well. However, I have often found myself wondering a few things, most notably the Unit of Work and Repository implementation not calling SaveChanges. The only place where I see you doing this is in Northwind.Tests. In CustomerService.cs, both delete and insert is called, but there is no subsequent save changes called. I realize, youre not using the EF6 repo implementation in that example, but you have SaveChanges on the interface, why is never called in the examples? Where is it otherwise intended that one would call save changes with this pattern?

I mentioned I modified my repository to simply call SaveChanges after each call to insert/update/delete, but it seems from looking at this framework that is not the intention. Your integration/unit tests call it wrapped in a using block, but the unit of work property is private and is created using IoC/Di so its not quite so simple as to call unitofwork.SaveChanges from the service. Am I missing something here?