-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: Run SonarQube Analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
paths-ignore: | ||
- "**.md" | ||
- ".vscode/**" | ||
|
||
concurrency: | ||
group: sonarqube-analysis | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/tests-base.yaml | ||
with: | ||
sonarqube: true | ||
sonarqube_host: ${{ vars.SONARQUBE_HOST }} | ||
secrets: | ||
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace DIT.Workflower.DependencyInjection; | ||
|
||
public record DIContextWrapper<TContext>(TContext Context, IServiceProvider ServiceProvider); |
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
35 changes: 35 additions & 0 deletions
35
src/DIT.Workflower.DependencyInjection/Extensions/IServiceProviderExtensions.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,35 @@ | ||
namespace DIT.Workflower.DependencyInjection.Extensions; | ||
|
||
public static class IServiceProviderExtensions | ||
{ | ||
public static IWorkflowFactory<TState, TCommand, DIContextWrapper<TContext>> GetRequiredWorkflowFactory<TState, TCommand, TContext>(this IServiceProvider sp) | ||
where TState : struct | ||
where TCommand : struct | ||
{ | ||
return sp.GetRequiredService<IWorkflowFactory<TState, TCommand, DIContextWrapper<TContext>>>(); | ||
} | ||
|
||
public static IWorkflowFactory<TState, TCommand, DIContextWrapper<TContext>>? GetWorkflowFactory<TState, TCommand, TContext>(this IServiceProvider sp) | ||
where TState : struct | ||
where TCommand : struct | ||
{ | ||
return sp.GetService<IWorkflowFactory<TState, TCommand, DIContextWrapper<TContext>>>(); | ||
} | ||
|
||
public static IWorkflow<TState, TCommand, DIContextWrapper<TContext>> CreateWorkflow<TState, TCommand, TContext>(this IServiceProvider sp, int version = 1) | ||
where TState : struct | ||
where TCommand : struct | ||
{ | ||
var factory = GetRequiredWorkflowFactory<TState, TCommand, TContext>(sp); | ||
return factory.CreateWorkflow(version); | ||
} | ||
|
||
public static IWorkflow<TState, TCommand, DIContextWrapper<TContext>> CreateWorkflow<TState, TCommand, TContext>(this IServiceProvider sp, string id, int version = 1) | ||
where TState : struct | ||
where TCommand : struct | ||
{ | ||
var factory = GetRequiredWorkflowFactory<TState, TCommand, TContext>(sp); | ||
return factory.CreateWorkflow(id, version); | ||
} | ||
|
||
} |
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