Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory provider idempotency updates #25

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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Runtime.Serialization;

namespace WorkflowCore.Persistence.EntityFramework.Exceptions
namespace WorkflowCore.Exceptions
{
public class WorkflowExistsException : Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using WorkflowCore.Exceptions;
using WorkflowCore.Interface;
using WorkflowCore.Models;

Expand Down Expand Up @@ -30,6 +31,11 @@ public async Task<string> CreateNewWorkflow(WorkflowInstance workflow, Cancellat
{
lock (_instances)
{
if (workflow.Reference != null && _instances.Any(x => x.Reference == workflow.Reference))
{
throw new WorkflowExistsException();
}

workflow.Id = Guid.NewGuid().ToString();
_instances.Add(workflow);
return workflow.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using WorkflowCore.Persistence.EntityFramework.Exceptions;
using WorkflowCore.Exceptions;
using WorkflowCore.Persistence.EntityFramework.Models;
using WorkflowCore.Persistence.EntityFramework.Services;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
using WorkflowCore.Exceptions;
using WorkflowCore.IntegrationTests.Scenarios;
using WorkflowCore.Interface;
using WorkflowCore.Models;
using WorkflowCore.Persistence.EntityFramework.Exceptions;
using WorkflowCore.Persistence.EntityFramework.Interfaces;
using WorkflowCore.Testing;
using Xunit;
Expand Down
Loading