Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions WorkflowCore.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EF47161E-E399-451C-BDE8-E92AAD3BD761}"
EndProject
Expand Down Expand Up @@ -135,6 +135,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkflowCore.Tests.Elastics
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkflowCore.Tests.Redis", "test\WorkflowCore.Tests.Redis\WorkflowCore.Tests.Redis.csproj", "{78217204-B873-40B9-8875-E3925B2FBCEC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowCore.DSL", "src\WorkflowCore.DSL\WorkflowCore.DSL.csproj", "{20B98905-08CB-4854-8E2C-A31A078383E9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -329,6 +331,10 @@ Global
{78217204-B873-40B9-8875-E3925B2FBCEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78217204-B873-40B9-8875-E3925B2FBCEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78217204-B873-40B9-8875-E3925B2FBCEC}.Release|Any CPU.Build.0 = Release|Any CPU
{20B98905-08CB-4854-8E2C-A31A078383E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20B98905-08CB-4854-8E2C-A31A078383E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20B98905-08CB-4854-8E2C-A31A078383E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20B98905-08CB-4854-8E2C-A31A078383E9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -384,6 +390,7 @@ Global
{F6348170-B695-4D97-BAE6-4F0F643F3BEF} = {2EEE6ABD-EE9B-473F-AF2D-6DABB85D7BA2}
{44644716-0CE8-4837-B189-AB65AE2106AA} = {E6CEAD8D-F565-471E-A0DC-676F54EAEDEB}
{78217204-B873-40B9-8875-E3925B2FBCEC} = {E6CEAD8D-F565-471E-A0DC-676F54EAEDEB}
{20B98905-08CB-4854-8E2C-A31A078383E9} = {EF47161E-E399-451C-BDE8-E92AAD3BD761}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC0FA8D3-6449-4FDA-BB46-ECF58FAD23B4}
Expand Down
3 changes: 2 additions & 1 deletion docs/json-yaml.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Loading workflow definitions from JSON or YAML

Simply grab the `DefinitionLoader` from the IoC container and call the `.LoadDefinition` method
Install the `WorkflowCore.DSL` package from nuget and call `AddWorkflowDSL` on your service collection.
Then grab the `DefinitionLoader` from the IoC container and call the `.LoadDefinition` method

```c#
using WorkflowCore.Interface;
Expand Down
20 changes: 20 additions & 0 deletions src/WorkflowCore.DSL/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using WorkflowCore.Interface;
using WorkflowCore.Services.DefinitionStorage;

namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddWorkflowDSL(this IServiceCollection services)
{
services.AddTransient<IDefinitionLoader, DefinitionLoader>();
return services;
}
}
}

24 changes: 24 additions & 0 deletions src/WorkflowCore.DSL/WorkflowCore.DSL.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.0.0</Version>
<Description>DSL extenstion for Workflow Core provding support for JSON and YAML workflow definitions.</Description>
<Authors>Daniel Gerlag</Authors>
<Company />
<Product>WorkflowCore</Product>
<PackageProjectUrl>https://github.com/danielgerlag/workflow-core</PackageProjectUrl>
<RepositoryUrl>https://github.com/danielgerlag/workflow-core.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="SharpYaml" Version="1.6.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\WorkflowCore\WorkflowCore.csproj" />
</ItemGroup>

</Project>
2 changes: 0 additions & 2 deletions src/WorkflowCore/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Microsoft.Extensions.ObjectPool;
using WorkflowCore.Primitives;
using WorkflowCore.Services.BackgroundTasks;
using WorkflowCore.Services.DefinitionStorage;
using WorkflowCore.Services.ErrorHandlers;

namespace Microsoft.Extensions.DependencyInjection
Expand Down Expand Up @@ -60,7 +59,6 @@ public static IServiceCollection AddWorkflow(this IServiceCollection services, A
services.AddTransient<IPooledObjectPolicy<IWorkflowExecutor>, InjectedObjectPoolPolicy<IWorkflowExecutor>>();

services.AddTransient<ISyncWorkflowRunner, SyncWorkflowRunner>();
services.AddTransient<IDefinitionLoader, DefinitionLoader>();

services.AddTransient<Foreach>();

Expand Down
4 changes: 4 additions & 0 deletions src/WorkflowCore/WorkflowCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Services\DefinitionStorage\" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions test/WorkflowCore.Testing/JsonWorkflowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private void Host_OnStepError(WorkflowInstance workflow, WorkflowStep step, Exce
protected virtual void ConfigureServices(IServiceCollection services)
{
services.AddWorkflow();
services.AddWorkflowDSL();
}

public string StartWorkflow(string json, object data)
Expand Down
1 change: 1 addition & 0 deletions test/WorkflowCore.Testing/WorkflowCore.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WorkflowCore.DSL\WorkflowCore.DSL.csproj" />
<ProjectReference Include="..\..\src\WorkflowCore\WorkflowCore.csproj" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions test/WorkflowCore.Testing/YamlWorkflowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private void Host_OnStepError(WorkflowInstance workflow, WorkflowStep step, Exce
protected virtual void ConfigureServices(IServiceCollection services)
{
services.AddWorkflow();
services.AddWorkflowDSL();
}

public string StartWorkflow(string json, object data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WorkflowCore.DSL\WorkflowCore.DSL.csproj" />
<ProjectReference Include="..\..\src\WorkflowCore\WorkflowCore.csproj" />
<ProjectReference Include="..\WorkflowCore.TestAssets\WorkflowCore.TestAssets.csproj" />
</ItemGroup>
Expand Down