diff --git a/src/clients/Elsa.Client/Models/PostWorkflowDefinitionRequest.cs b/src/clients/Elsa.Client/Models/PostWorkflowDefinitionRequest.cs deleted file mode 100644 index 8f9cc9922..000000000 --- a/src/clients/Elsa.Client/Models/PostWorkflowDefinitionRequest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -namespace Elsa.Client.Models -{ - public class PostWorkflowDefinitionRequest - { - public string? Name { get; set; } - public string? DisplayName { get; set; } - public string? Description { get; set; } - public Variables? Variables { get; set; } - public WorkflowContextOptions? ContextOptions { get; set; } - public bool IsSingleton { get; set; } - public WorkflowPersistenceBehavior PersistenceBehavior { get; set; } - public bool DeleteCompletedInstances { get; set; } - public bool Enabled { get; set; } - public bool Publish { get; set; } - public ICollection Activities { get; set; } = new System.Collections.Generic.List(); - public ICollection Connections { get; set; } = new System.Collections.Generic.List(); - } -} \ No newline at end of file diff --git a/src/clients/Elsa.Client/Services/IWorkflowDefinitionsApi.cs b/src/clients/Elsa.Client/Services/IWorkflowDefinitionsApi.cs index beceb20bf..9a848e95c 100644 --- a/src/clients/Elsa.Client/Services/IWorkflowDefinitionsApi.cs +++ b/src/clients/Elsa.Client/Services/IWorkflowDefinitionsApi.cs @@ -17,9 +17,6 @@ namespace Elsa.Client.Services Task> ListAsync(int? page = default, int? pageSize = default, VersionOptions? versionOptions = default, CancellationToken cancellationToken = default); [Post("/v1/workflow-definitions")] - Task PostAsync([Body(BodySerializationMethod.Serialized)] PostWorkflowDefinitionRequest request, CancellationToken cancellationToken = default); - - [Post("/v1/workflow-definitions/{workflowDefinitionId}")] - Task PostAsync(string workflowDefinitionId, [Body(BodySerializationMethod.Serialized)] PostWorkflowDefinitionRequest request, CancellationToken cancellationToken = default); + Task PostAsync([Body(BodySerializationMethod.Serialized)] WorkflowDefinition workflowDefinition, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/core/Elsa.Abstractions/Elsa.Abstractions.csproj b/src/core/Elsa.Abstractions/Elsa.Abstractions.csproj index 590061691..9f9b2ffaf 100644 --- a/src/core/Elsa.Abstractions/Elsa.Abstractions.csproj +++ b/src/core/Elsa.Abstractions/Elsa.Abstractions.csproj @@ -40,7 +40,7 @@ - + diff --git a/src/core/Elsa.Abstractions/Models/ActivityDefinition.cs b/src/core/Elsa.Abstractions/Models/ActivityDefinition.cs index 45726df8b..a23bc2ea2 100644 --- a/src/core/Elsa.Abstractions/Models/ActivityDefinition.cs +++ b/src/core/Elsa.Abstractions/Models/ActivityDefinition.cs @@ -12,6 +12,6 @@ namespace Elsa.Models public bool PersistWorkflow { get; set; } public bool LoadWorkflowContext { get; set; } public bool SaveWorkflowContext { get; set; } - public ActivityDefinitionProperties Properties { get; set; } = new ActivityDefinitionProperties(); + public ActivityDefinitionProperties Properties { get; set; } = new(); } } \ No newline at end of file diff --git a/src/core/Elsa.Abstractions/Models/CompositeActivityDefinition.cs b/src/core/Elsa.Abstractions/Models/CompositeActivityDefinition.cs index 8f42904f6..b3fabaf99 100644 --- a/src/core/Elsa.Abstractions/Models/CompositeActivityDefinition.cs +++ b/src/core/Elsa.Abstractions/Models/CompositeActivityDefinition.cs @@ -3,7 +3,7 @@ using Elsa.Services; namespace Elsa.Models { - public class CompositeActivityDefinition : ActivityDefinition + public class CompositeActivityDefinition : ActivityDefinition, ICompositeActivityDefinition { public CompositeActivityDefinition() { diff --git a/src/core/Elsa.Abstractions/Models/ICompositeActivityDefinition.cs b/src/core/Elsa.Abstractions/Models/ICompositeActivityDefinition.cs new file mode 100644 index 000000000..1e1787664 --- /dev/null +++ b/src/core/Elsa.Abstractions/Models/ICompositeActivityDefinition.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Elsa.Models +{ + public interface ICompositeActivityDefinition + { + public ICollection Activities { get; set; } + public ICollection Connections { get; set; } + } +} \ No newline at end of file diff --git a/src/core/Elsa.Abstractions/Models/WorkflowDefinition.cs b/src/core/Elsa.Abstractions/Models/WorkflowDefinition.cs index 1d10f5908..69ca7ff36 100644 --- a/src/core/Elsa.Abstractions/Models/WorkflowDefinition.cs +++ b/src/core/Elsa.Abstractions/Models/WorkflowDefinition.cs @@ -1,15 +1,25 @@ -namespace Elsa.Models +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elsa.Models { - public class WorkflowDefinition : CompositeActivityDefinition + public class WorkflowDefinition : ICompositeActivityDefinition { public WorkflowDefinition() { Variables = new Variables(); + Activities = new List(); + Connections = new List(); } - + + [Newtonsoft.Json.JsonIgnore] + [JsonIgnore] public int Id { get; set; } public string WorkflowDefinitionId { get; set; } = default!; public string WorkflowDefinitionVersionId { get; set; } = default!; + public string? Name { get; set; } + public string? DisplayName { get; set; } + public string? Description { get; set; } public int Version { get; set; } public Variables? Variables { get; set; } public WorkflowContextOptions? ContextOptions { get; set; } @@ -19,5 +29,7 @@ public bool IsEnabled { get; set; } public bool IsPublished { get; set; } public bool IsLatest { get; set; } + public ICollection Activities { get; set; } + public ICollection Connections { get; set; } } } \ No newline at end of file diff --git a/src/core/Elsa.Abstractions/Services/IWorkflowDefinitionManager.cs b/src/core/Elsa.Abstractions/Services/IWorkflowDefinitionManager.cs index 51e0a7d58..189e9be8b 100644 --- a/src/core/Elsa.Abstractions/Services/IWorkflowDefinitionManager.cs +++ b/src/core/Elsa.Abstractions/Services/IWorkflowDefinitionManager.cs @@ -22,5 +22,6 @@ namespace Elsa.Services where TIndex : class, IIndex; IQuery ExecuteQuery(ICompiledQuery query); + WorkflowDefinition Initialize(WorkflowDefinition workflowDefinition); } } \ No newline at end of file diff --git a/src/core/Elsa.Core/Elsa.Core.csproj b/src/core/Elsa.Core/Elsa.Core.csproj index 84a79ade3..c5f93a9eb 100644 --- a/src/core/Elsa.Core/Elsa.Core.csproj +++ b/src/core/Elsa.Core/Elsa.Core.csproj @@ -51,7 +51,7 @@ - + diff --git a/src/core/Elsa.Core/Services/WorkflowBlueprintMaterializer.cs b/src/core/Elsa.Core/Services/WorkflowBlueprintMaterializer.cs index d81584042..54c05ef5e 100644 --- a/src/core/Elsa.Core/Services/WorkflowBlueprintMaterializer.cs +++ b/src/core/Elsa.Core/Services/WorkflowBlueprintMaterializer.cs @@ -38,10 +38,10 @@ namespace Elsa.Services ); } - private static ActivityPropertyProviders CreatePropertyProviders(CompositeActivityDefinition workflowDefinition) + private static ActivityPropertyProviders CreatePropertyProviders(ICompositeActivityDefinition compositeActivityDefinition) { var propertyProviders = new ActivityPropertyProviders(); - var activityDefinitions = workflowDefinition.Activities; + var activityDefinitions = compositeActivityDefinition.Activities; foreach (var activityDefinition in activityDefinitions) { diff --git a/src/core/Elsa.Core/Services/WorkflowDefinitionManager.cs b/src/core/Elsa.Core/Services/WorkflowDefinitionManager.cs index 202155b38..6669a9e36 100644 --- a/src/core/Elsa.Core/Services/WorkflowDefinitionManager.cs +++ b/src/core/Elsa.Core/Services/WorkflowDefinitionManager.cs @@ -14,14 +14,17 @@ namespace Elsa.Services public class WorkflowDefinitionManager : IWorkflowDefinitionManager { private readonly ISession _session; + private readonly IIdGenerator _idGenerator; - public WorkflowDefinitionManager(ISession session) + public WorkflowDefinitionManager(ISession session, IIdGenerator idGenerator) { _session = session; + _idGenerator = idGenerator; } public Task SaveAsync(WorkflowDefinition workflowDefinition, CancellationToken cancellationToken = default) { + workflowDefinition = Initialize(workflowDefinition); _session.Save(workflowDefinition, CollectionNames.WorkflowDefinitions); return Task.CompletedTask; } @@ -54,5 +57,19 @@ namespace Elsa.Services public IQuery Query() where TIndex : class, IIndex => _session.Query(CollectionNames.WorkflowDefinitions); public IQuery Query(Expression> predicate) where TIndex : class, IIndex => _session.Query(predicate, CollectionNames.WorkflowDefinitions); public IQuery ExecuteQuery(ICompiledQuery query) => _session.ExecuteQuery(query, CollectionNames.WorkflowDefinitions); + + public WorkflowDefinition Initialize(WorkflowDefinition workflowDefinition) + { + if (string.IsNullOrWhiteSpace(workflowDefinition.WorkflowDefinitionId)) + workflowDefinition.WorkflowDefinitionId = _idGenerator.Generate(); + + if (workflowDefinition.Version == 0) + workflowDefinition.Version = 1; + + if (string.IsNullOrWhiteSpace(workflowDefinition.WorkflowDefinitionVersionId)) + workflowDefinition.WorkflowDefinitionVersionId = _idGenerator.Generate(); + + return workflowDefinition; + } } } \ No newline at end of file diff --git a/src/dashboards/blazor/ElsaDashboard.Application.Server/ElsaDashboard.Application.Server.csproj b/src/dashboards/blazor/ElsaDashboard.Application.Server/ElsaDashboard.Application.Server.csproj index 68ed790d4..d75f47b54 100644 --- a/src/dashboards/blazor/ElsaDashboard.Application.Server/ElsaDashboard.Application.Server.csproj +++ b/src/dashboards/blazor/ElsaDashboard.Application.Server/ElsaDashboard.Application.Server.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/dashboards/blazor/ElsaDashboard.Application/Models/ConnectionModel.cs b/src/dashboards/blazor/ElsaDashboard.Application/Models/ConnectionModel.cs index 22ecf7e7d..c4b16ee81 100644 --- a/src/dashboards/blazor/ElsaDashboard.Application/Models/ConnectionModel.cs +++ b/src/dashboards/blazor/ElsaDashboard.Application/Models/ConnectionModel.cs @@ -1,4 +1,4 @@ namespace ElsaDashboard.Application.Models { - public sealed record ConnectionModel(string SourceId, string? TargetId, string Outcome); + public sealed record ConnectionModel(string SourceId, string TargetId, string Outcome); } \ No newline at end of file diff --git a/src/dashboards/blazor/ElsaDashboard.Application/Pages/Designer.razor.cs b/src/dashboards/blazor/ElsaDashboard.Application/Pages/Designer.razor.cs index fbfa9cd88..f974d7926 100644 --- a/src/dashboards/blazor/ElsaDashboard.Application/Pages/Designer.razor.cs +++ b/src/dashboards/blazor/ElsaDashboard.Application/Pages/Designer.razor.cs @@ -17,6 +17,7 @@ namespace ElsaDashboard.Application.Pages [Inject] private IWorkflowDefinitionService WorkflowDefinitionService { get; set; } = default!; [Inject] private IActivityService ActivityService { get; set; } = default!; private IDictionary ActivityDescriptors { get; set; } = default!; + private WorkflowDefinition WorkflowDefinition { get; set; } = default!; private WorkflowModel WorkflowModel { get; set; } = WorkflowModel.Blank(); private BackgroundWorker BackgroundWorker { get; } = new(); @@ -26,8 +27,8 @@ namespace ElsaDashboard.Application.Pages if (WorkflowDefinitionVersionId != null) { - var workflowDefinition = await WorkflowDefinitionService.GetByVersionIdAsync(WorkflowDefinitionVersionId); - WorkflowModel = CreateWorkflowModel(workflowDefinition); + WorkflowDefinition = await WorkflowDefinitionService.GetByVersionIdAsync(WorkflowDefinitionVersionId); + WorkflowModel = CreateWorkflowModel(WorkflowDefinition); } else { @@ -60,7 +61,8 @@ namespace ElsaDashboard.Application.Pages private async ValueTask SaveWorkflowAsync() { - + WorkflowDefinition.Connections = WorkflowModel.Connections.Select(x => new ConnectionDefinition(x.SourceId, x.TargetId, x.Outcome)).ToList(); + WorkflowDefinition = await WorkflowDefinitionService.SaveAsync(WorkflowDefinition); } private async Task OnWorkflowChanged(WorkflowModelChangedEventArgs e) diff --git a/src/dashboards/blazor/ElsaDashboard.Backend/ElsaDashboard.Backend.csproj b/src/dashboards/blazor/ElsaDashboard.Backend/ElsaDashboard.Backend.csproj index c703be00a..ebd569ca6 100644 --- a/src/dashboards/blazor/ElsaDashboard.Backend/ElsaDashboard.Backend.csproj +++ b/src/dashboards/blazor/ElsaDashboard.Backend/ElsaDashboard.Backend.csproj @@ -10,10 +10,10 @@ - - + + - + diff --git a/src/dashboards/blazor/ElsaDashboard.Backend/Rpc/WorkflowDefinitionService.cs b/src/dashboards/blazor/ElsaDashboard.Backend/Rpc/WorkflowDefinitionService.cs index ff9a70e6b..3b5e47635 100644 --- a/src/dashboards/blazor/ElsaDashboard.Backend/Rpc/WorkflowDefinitionService.cs +++ b/src/dashboards/blazor/ElsaDashboard.Backend/Rpc/WorkflowDefinitionService.cs @@ -18,6 +18,7 @@ namespace ElsaDashboard.Backend.Rpc public async Task> ListAsync(ListWorkflowDefinitionsRequest request, CallContext context) => await _elsaClient.WorkflowDefinitions.ListAsync(request.Page, request.PageSize, request.VersionOptions, context.CancellationToken); - public Task GetByVersionIdAsync(string workflowDefinitionVersionId, CallContext context = default) => _elsaClient.WorkflowDefinitions.GetByVersionIdAsync(workflowDefinitionVersionId, context.CancellationToken); + public Task GetByVersionIdAsync(string workflowDefinitionVersionId, CallContext context) => _elsaClient.WorkflowDefinitions.GetByVersionIdAsync(workflowDefinitionVersionId, context.CancellationToken); + public async Task SaveAsync(WorkflowDefinition workflowDefinition, CallContext context) => await _elsaClient.WorkflowDefinitions.PostAsync(workflowDefinition, context.CancellationToken); } } \ No newline at end of file diff --git a/src/dashboards/blazor/ElsaDashboard.Shared/ElsaDashboard.Shared.csproj b/src/dashboards/blazor/ElsaDashboard.Shared/ElsaDashboard.Shared.csproj index 865758397..c0bc2c39e 100644 --- a/src/dashboards/blazor/ElsaDashboard.Shared/ElsaDashboard.Shared.csproj +++ b/src/dashboards/blazor/ElsaDashboard.Shared/ElsaDashboard.Shared.csproj @@ -6,11 +6,11 @@ - + - - + + diff --git a/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IActivityService.cs b/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IActivityService.cs index d99d50c5e..ecdefbab4 100644 --- a/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IActivityService.cs +++ b/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IActivityService.cs @@ -1,17 +1,14 @@ using System.Collections.Generic; -using System.ServiceModel; using System.Threading.Tasks; using Elsa.Client.Models; -using ProtoBuf; using ProtoBuf.Grpc; -using ProtoBuf.ServiceModel; +using ProtoBuf.Grpc.Configuration; namespace ElsaDashboard.Shared.Rpc { - [ServiceContract] + [Service] public interface IActivityService { - [ProtoBehavior] Task> GetActivitiesAsync(CallContext context = default); } } \ No newline at end of file diff --git a/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IWorkflowDefinitionService.cs b/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IWorkflowDefinitionService.cs index d81a9e3ca..b0350e75a 100644 --- a/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IWorkflowDefinitionService.cs +++ b/src/dashboards/blazor/ElsaDashboard.Shared/Rpc/IWorkflowDefinitionService.cs @@ -3,14 +3,16 @@ using System.Threading.Tasks; using Elsa.Client.Models; using ProtoBuf; using ProtoBuf.Grpc; +using ProtoBuf.Grpc.Configuration; namespace ElsaDashboard.Shared.Rpc { - [ServiceContract] + [Service] public interface IWorkflowDefinitionService { Task> ListAsync(ListWorkflowDefinitionsRequest request, CallContext context = default); Task GetByVersionIdAsync(string workflowDefinitionVersionId, CallContext context = default); + Task SaveAsync(WorkflowDefinition workflowDefinition, CallContext context = default); } [ProtoContract] diff --git a/src/samples/Elsa.Samples.CustomActivities/ReadQueryString.cs b/src/samples/Elsa.Samples.CustomActivities/ReadQueryString.cs index 4e967ef8f..c00c93bff 100644 --- a/src/samples/Elsa.Samples.CustomActivities/ReadQueryString.cs +++ b/src/samples/Elsa.Samples.CustomActivities/ReadQueryString.cs @@ -19,7 +19,7 @@ namespace Elsa.Samples.CustomActivities protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) { - var query = _httpContextAccessor.HttpContext.Request.Query; + var query = _httpContextAccessor.HttpContext!.Request.Query; return Done(query); } diff --git a/src/server/Elsa.Server.Api/Elsa.Server.Api.csproj b/src/server/Elsa.Server.Api/Elsa.Server.Api.csproj index 85f4c3533..41339b168 100644 --- a/src/server/Elsa.Server.Api/Elsa.Server.Api.csproj +++ b/src/server/Elsa.Server.Api/Elsa.Server.Api.csproj @@ -34,12 +34,6 @@ - - - Post.cs - - - diff --git a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.Request.cs b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.Request.cs deleted file mode 100644 index b66ee1ccd..000000000 --- a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.Request.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using Elsa.Models; - -namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions -{ - public class PostWorkflowDefinitionRequest - { - public string? Name { get; set; } - public string? DisplayName { get; set; } - public string? Description { get; set; } - public Variables? Variables { get; set; } - public WorkflowContextOptions? ContextOptions { get; set; } - public bool IsSingleton { get; set; } - public WorkflowPersistenceBehavior PersistenceBehavior { get; set; } - public bool DeleteCompletedInstances { get; set; } - public bool Enabled { get; set; } - public bool Publish { get; set; } - public ICollection Activities { get; set; } = new List(); - public ICollection Connections { get; set; } = new List(); - } -} \ No newline at end of file diff --git a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.cs b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.cs index 5f61c47f6..6f4097ae1 100644 --- a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.cs +++ b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Post.cs @@ -13,15 +13,14 @@ namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions [ApiController] [ApiVersion("1")] [Route("v{apiVersion:apiVersion}/workflow-definitions")] - [Route("v{apiVersion:apiVersion}/workflow-definitions/{workflowDefinitionId}")] [Produces("application/json")] public class Post : ControllerBase { - private readonly IWorkflowPublisher _workflowPublisher; + private readonly IWorkflowDefinitionManager _workflowDefinitionManager; - public Post(IWorkflowPublisher workflowPublisher) + public Post(IWorkflowDefinitionManager workflowDefinitionManager) { - _workflowPublisher = workflowPublisher; + _workflowDefinitionManager = workflowDefinitionManager; } [HttpPost] @@ -29,43 +28,13 @@ namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions [SwaggerResponseExample(StatusCodes.Status200OK, typeof(WorkflowDefinitionExample))] [SwaggerOperation( Summary = "Creates a new workflow definition or updates an existing one.", - Description = - "Creates a new workflow definition or updates an existing one. If the workflow already exists, a new draft is created and updated with the specified values. Use the Publish field to automatically publish the workflow.", + Description = "Creates a new workflow definition or updates an existing one.", OperationId = "WorkflowDefinitions.Post", Tags = new[] {"WorkflowDefinitions"}) ] - public async Task> Handle(string? workflowDefinitionId, PostWorkflowDefinitionRequest request, ApiVersion apiVersion, CancellationToken cancellationToken) + public async Task> Handle(WorkflowDefinition workflowDefinition, ApiVersion apiVersion, CancellationToken cancellationToken) { - workflowDefinitionId = workflowDefinitionId?.Trim(); - var workflowDefinition = !string.IsNullOrWhiteSpace(workflowDefinitionId) ? await _workflowPublisher.GetDraftAsync(workflowDefinitionId, cancellationToken) : default; - - if (workflowDefinition == null) - { - workflowDefinition = _workflowPublisher.New(); - - if (!string.IsNullOrWhiteSpace(workflowDefinitionId)) - workflowDefinition.WorkflowDefinitionId = workflowDefinitionId; - } - - workflowDefinition.Activities = request.Activities; - workflowDefinition.Connections = request.Connections; - workflowDefinition.Description = request.Description?.Trim(); - workflowDefinition.Name = request.Name?.Trim(); - workflowDefinition.Variables = request.Variables; - workflowDefinition.IsEnabled = request.Enabled; - workflowDefinition.IsSingleton = request.IsSingleton; - workflowDefinition.PersistenceBehavior = request.PersistenceBehavior; - workflowDefinition.DeleteCompletedInstances = request.DeleteCompletedInstances; - workflowDefinition.ContextOptions = request.ContextOptions; - workflowDefinition.Type = "Workflow"; - workflowDefinition.ActivityId = workflowDefinition.WorkflowDefinitionId; - workflowDefinition.DisplayName = request.DisplayName?.Trim(); - - if (request.Publish) - await _workflowPublisher.PublishAsync(workflowDefinition, cancellationToken); - else - await _workflowPublisher.SaveDraftAsync(workflowDefinition, cancellationToken); - + await _workflowDefinitionManager.SaveAsync(workflowDefinition, cancellationToken); return CreatedAtAction("Handle", "GetByVersionId", new {workflowDefinitionVersionId = workflowDefinition.WorkflowDefinitionVersionId, apiVersion = apiVersion.ToString()}, workflowDefinition); } } diff --git a/src/server/Elsa.Server.Api/Swagger/WorkflowDefinitionExample.cs b/src/server/Elsa.Server.Api/Swagger/WorkflowDefinitionExample.cs index 7b22dfbd5..2fa45a2c4 100644 --- a/src/server/Elsa.Server.Api/Swagger/WorkflowDefinitionExample.cs +++ b/src/server/Elsa.Server.Api/Swagger/WorkflowDefinitionExample.cs @@ -19,7 +19,6 @@ namespace Elsa.Server.Api.Swagger IsPublished = true, WorkflowDefinitionId = Guid.NewGuid().ToString("N"), WorkflowDefinitionVersionId = Guid.NewGuid().ToString("N"), - Type = "Workflow", ContextOptions = new WorkflowContextOptions { ContextFidelity = WorkflowContextFidelity.Burst, diff --git a/src/server/Elsa.Server.Host/Elsa.Server.Host.csproj b/src/server/Elsa.Server.Host/Elsa.Server.Host.csproj index 6ced2ffae..c8c06c048 100644 --- a/src/server/Elsa.Server.Host/Elsa.Server.Host.csproj +++ b/src/server/Elsa.Server.Host/Elsa.Server.Host.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/component/Elsa.ComponentTests/Clients/RestClient/WorkflowDefinitions/PostTests.cs b/test/component/Elsa.ComponentTests/Clients/RestClient/WorkflowDefinitions/PostTests.cs index 190480254..b3259b96b 100644 --- a/test/component/Elsa.ComponentTests/Clients/RestClient/WorkflowDefinitions/PostTests.cs +++ b/test/component/Elsa.ComponentTests/Clients/RestClient/WorkflowDefinitions/PostTests.cs @@ -17,12 +17,12 @@ namespace Elsa.ComponentTests.Clients.RestClient.WorkflowDefinitions [Fact(DisplayName = "Posting a new workflow definition returns HTTP 201.")] public async Task Post01() { - var request = CreateWorkflowDefinitionRequest(); + var request = CreateWorkflowDefinition(); var workflowDefinition = await ElsaClient.WorkflowDefinitions.PostAsync(request); Assert.Equal(request.Name, workflowDefinition.Name); } - private PostWorkflowDefinitionRequest CreateWorkflowDefinitionRequest() + private WorkflowDefinition CreateWorkflowDefinition() { var writeLine = new ActivityDefinition { @@ -38,7 +38,7 @@ namespace Elsa.ComponentTests.Clients.RestClient.WorkflowDefinitions var activities = new[] {writeLine, readLine}; var connections = new[] {new ConnectionDefinition(writeLine.ActivityId, readLine.ActivityId, OutcomeNames.Done)}; - return Fixture.Build() + return Fixture.Build() .With(x => x.Activities, activities) .With(x => x.Connections, connections) .Create(); diff --git a/test/component/Elsa.ComponentTests/Endpoints/WorkflowDefinitions/PostTests.cs b/test/component/Elsa.ComponentTests/Endpoints/WorkflowDefinitions/PostTests.cs index 04287203e..cebeaedc8 100644 --- a/test/component/Elsa.ComponentTests/Endpoints/WorkflowDefinitions/PostTests.cs +++ b/test/component/Elsa.ComponentTests/Endpoints/WorkflowDefinitions/PostTests.cs @@ -18,14 +18,12 @@ namespace Elsa.ComponentTests.Endpoints.WorkflowDefinitions { private readonly IFixture _fixture; private readonly TemporaryFolder _tempFolder; - private readonly ElsaHostApplicationFactory _hostApplicationFactory; private readonly HttpClient _httpClient; public PostTests(ElsaHostApplicationFactory hostApplicationFactory) { _fixture = new Fixture().Customize(new NodaTimeCustomization()); _tempFolder = new TemporaryFolder(); - _hostApplicationFactory = hostApplicationFactory; hostApplicationFactory.SetDbConnectionString($@"Data Source={_tempFolder.Folder}elsa.db;Cache=Shared"); _httpClient = hostApplicationFactory.CreateClient(); } @@ -39,7 +37,7 @@ namespace Elsa.ComponentTests.Endpoints.WorkflowDefinitions Assert.Equal(HttpStatusCode.Created, response.StatusCode); } - private PostWorkflowDefinitionRequest CreateWorkflowDefinitionRequest() + private WorkflowDefinition CreateWorkflowDefinitionRequest() { var writeLine = new ActivityDefinition { @@ -55,7 +53,7 @@ namespace Elsa.ComponentTests.Endpoints.WorkflowDefinitions var activities = new[] { writeLine, readLine }; var connections = new[] { new ConnectionDefinition(writeLine.ActivityId, readLine.ActivityId, OutcomeNames.Done) }; - return _fixture.Build() + return _fixture.Build() .With(x => x.Activities, activities) .With(x => x.Connections, connections) .Create(); diff --git a/test/integration/Elsa.Core.IntegrationTests/Elsa.Core.IntegrationTests.csproj b/test/integration/Elsa.Core.IntegrationTests/Elsa.Core.IntegrationTests.csproj index d9c92ae95..a5a97e6ed 100644 --- a/test/integration/Elsa.Core.IntegrationTests/Elsa.Core.IntegrationTests.csproj +++ b/test/integration/Elsa.Core.IntegrationTests/Elsa.Core.IntegrationTests.csproj @@ -20,8 +20,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +