Calling `DataContext.SaveChangesAsync()` causes `DbContext` to call `DataContext.SaveChangesAsync(CancellationToken)`, meaning `base.SaveChangesAsync` and `SyncObjectsStatePostCommit` are invoked twice, once by each of the DataContext implementations.
Proposed fix shown below,
- commit reference: [GenericUnitOfWorkABContrib: e402fa3d](https://genericunitofworkandrepositories.codeplex.com/SourceControl/network/forks/AGBrown/GenericUnitOfWorkABContrib/changeset/e402fa3dc8245bc048cc6bbdde4a1a43849b4ecf)
- Pull request: [7102](https://genericunitofworkandrepositories.codeplex.com/SourceControl/network/forks/AGBrown/GenericUnitOfWorkABContrib/contribution/7102)
(note: prior commit also includes documentation for the DataContext class)
_Version:_
- Last seen: [0d465a66]( https://genericunitofworkandrepositories.codeplex.com/SourceControl/changeset/0d465a6614f274d562a6bfc25059c25a10bed7b0)
_Impact:_
- performance
_Proposed fix:_
public override async Task<int> SaveChangesAsync()
{
return await this.SaveChangesAsync(CancellationToken.None);
}
Proposed fix shown below,
- commit reference: [GenericUnitOfWorkABContrib: e402fa3d](https://genericunitofworkandrepositories.codeplex.com/SourceControl/network/forks/AGBrown/GenericUnitOfWorkABContrib/changeset/e402fa3dc8245bc048cc6bbdde4a1a43849b4ecf)
- Pull request: [7102](https://genericunitofworkandrepositories.codeplex.com/SourceControl/network/forks/AGBrown/GenericUnitOfWorkABContrib/contribution/7102)
(note: prior commit also includes documentation for the DataContext class)
_Version:_
- Last seen: [0d465a66]( https://genericunitofworkandrepositories.codeplex.com/SourceControl/changeset/0d465a6614f274d562a6bfc25059c25a10bed7b0)
_Impact:_
- performance
_Proposed fix:_
public override async Task<int> SaveChangesAsync()
{
return await this.SaveChangesAsync(CancellationToken.None);
}