Skip to content

Commit

Permalink
After remove multiple execution scopes , Persistence related items al…
Browse files Browse the repository at this point in the history
…so need to be updated. (#429)

* Update WorkflowInstanceDocument.cs
* Remove multiple execution scopes
* Remove multiple execution scopes
* Fix Yessql
* Remove yessql from web project

Co-authored-by: hyz <hyz@DESKTOP-KJ2A9G2>
  • Loading branch information
hyzx86 and hyz authored Oct 27, 2020
1 parent d5095f7 commit 5716de8
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ node_modules/
#github
.github/

App_Data/
App_Data/
/src/samples/Elsa.Samples.HelloWorldHttp/Properties/launchSettings.json
/src/samples/Elsa.Samples.CustomActivities/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand Down
10 changes: 5 additions & 5 deletions src/dashboard/Elsa.Dashboard.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
var elsaSection = Configuration.GetSection("Elsa");

services
// Add workflow services.
.AddElsa(x => x.AddMongoDbStores(Configuration, "Elsa", "MongoDb"))

// Add activities we'd like to use.
// Configuring the activities as is done here is only required if we want to be able to actually run workflows form this application.
// Otherwise it's only necessary to register activities for the workflow designer to discover.
.AddHttpActivities(options => options.Bind(elsaSection.GetSection("Http")))
.AddEmailActivities(options => options.Bind(elsaSection.GetSection("Smtp")))
.AddTimerActivities(options => options.Bind(elsaSection.GetSection("Timers")))

// Add Dashboard services.
.AddElsaDashboard();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();

app
// This is only necessary if we want to be able to run workflows containing HTTP activities from this application.
.UseHttpActivities()

.UseStaticFiles()
.UseRouting()
.UseEndpoints(endpoints => endpoints.MapControllers())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class WorkflowInstanceDocument : DocumentBase
public IDictionary<string, ActivityInstance> Activities { get; set; } =
new Dictionary<string, ActivityInstance>();

[JsonProperty(PropertyName = "scopes")]
public Stack<WorkflowExecutionScope> Scopes { get; set; }
[JsonProperty(PropertyName = "scope")]
public WorkflowExecutionScope Scope { get; set; }

[JsonProperty(PropertyName = "input")] public Variables Input { get; set; }

Expand All @@ -53,4 +53,4 @@ public class WorkflowInstanceDocument : DocumentBase

[JsonProperty(PropertyName = "fault")] public WorkflowFault Fault { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ private void ConfigureWorkflowInstance(ModelBuilder modelBuilder)
entity.Property(x => x.Status).HasConversion<string>();

entity
.Property(x => x.Scopes)
.Property(x => x.Scope)
.HasConversion(
x => Serialize(x),
x => DeserializeScopes(x)
x => Deserialize<WorkflowExecutionScope>(x)
);

entity
Expand Down Expand Up @@ -178,12 +178,6 @@ private string Serialize(object value)
private T Deserialize<T>(string json)
{
return JsonConvert.DeserializeObject<T>(json, serializerSettings);
}

private Stack<WorkflowExecutionScope> DeserializeScopes(string json)
{
var reversedScopes = JsonConvert.DeserializeObject<Stack<WorkflowExecutionScope>>(json, serializerSettings);
return reversedScopes is { } ? new Stack<WorkflowExecutionScope>(reversedScopes) : null;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class WorkflowInstanceEntity
public DateTime? FinishedAt { get; set; }
public DateTime? FaultedAt { get; set; }
public DateTime? AbortedAt { get; set; }
public Stack<WorkflowExecutionScope> Scopes { get; set; }
public WorkflowExecutionScope Scope { get; set; }
public Variables Input { get; set; }
public ICollection<LogEntry> ExecutionLog { get; set; }
public WorkflowFault Fault { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class WorkflowInstanceDocument
public DateTime? FaultedAt { get; set; }
public DateTime? AbortedAt { get; set; }
public IDictionary<string, ActivityInstance> Activities { get; set; } = new Dictionary<string, ActivityInstance>();
public Stack<WorkflowExecutionScope> Scopes { get; set; }
public WorkflowExecutionScope Scope { get; set; }
public Variables Input { get; set; }
public HashSet<BlockingActivity> BlockingActivities { get; set; }
public ICollection<LogEntry> ExecutionLog { get; set; }
public WorkflowFault Fault { get; set; }
}
}
}

0 comments on commit 5716de8

Please sign in to comment.