-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from marcwittke/hotfix/5.1.12
Hotfix/5.1.12
- Loading branch information
Showing
13 changed files
with
145 additions
and
48 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/abstractions/Backend.Fx/Environment/Persistence/IDatabaseUtil.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Backend.Fx.Environment.Persistence | ||
{ | ||
public interface IDatabaseUtil | ||
{ | ||
bool WaitUntilAvailable(int retries, Func<int, TimeSpan> sleepDurationProvider); | ||
Task<bool> WaitUntilAvailableAsync(int retries, Func<int, TimeSpan> sleepDurationProvider, CancellationToken cancellationToken = default); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/environments/Backend.Fx.AspNetCore.Mvc/UnitOfWork/UnitOfWorkFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Backend.Fx.Patterns.DependencyInjection; | ||
using Backend.Fx.Patterns.UnitOfWork; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
|
||
namespace Backend.Fx.AspNetCore.Mvc.UnitOfWork | ||
{ | ||
public class UnitOfWorkFilter : IActionFilter | ||
{ | ||
private readonly IBackendFxApplication _application; | ||
|
||
public UnitOfWorkFilter(IBackendFxApplication application) | ||
{ | ||
_application = application; | ||
} | ||
|
||
public void OnActionExecuting(ActionExecutingContext context) | ||
{ | ||
var unitOfWork = _application.CompositionRoot.GetInstance<IUnitOfWork>(); | ||
if (context.HttpContext.Request.IsSafe()) | ||
{ | ||
unitOfWork = new ReadonlyDecorator(unitOfWork); | ||
} | ||
unitOfWork.Begin(); | ||
} | ||
|
||
public void OnActionExecuted(ActionExecutedContext context) | ||
{ | ||
var unitOfWork = _application.CompositionRoot.GetInstance<IUnitOfWork>(); | ||
|
||
try | ||
{ | ||
unitOfWork.Complete(); | ||
} | ||
finally | ||
{ | ||
unitOfWork.Dispose(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.