diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 137a6cc77..31b609b1e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -12,6 +12,16 @@ ports: - "5432:5432" + sqlserver: + image: mcr.microsoft.com/mssql/server:2022-latest + environment: + - ACCEPT_EULA=Y + - MSSQL_SA_PASSWORD=!Elsa2025@ + ports: + - 1433:1433 + volumes: + - sqlserver_data:/var/opt/mssql + mysql: image: mysql:8.0 container_name: mysql @@ -126,6 +136,7 @@ - "14000:8080" volumes: + sqlserver_data: postgres-data: oracle-data-free1: mysql_data2: diff --git a/src/apps/Elsa.Server.Web/appsettings.json b/src/apps/Elsa.Server.Web/appsettings.json index 9010bf944..3fc86acdb 100644 --- a/src/apps/Elsa.Server.Web/appsettings.json +++ b/src/apps/Elsa.Server.Web/appsettings.json @@ -13,6 +13,7 @@ "AllowedHosts": "*", "ConnectionStrings": { "Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;", + "SqlServer": "Server=localhost,1433;Initial Catalog=Elsa;User=sa;Password=!Elsa2025@;Encrypt=false;PersistSecurityInfo=false", "MySql": "Server=localhost;Database=elsa;Uid=admin;Pwd=password;", "PostgreSql": "Server=localhost;Username=elsa;Database=elsa;Port=5432;Password=elsa;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60", "Citus": "Server=localhost;Username=citus;Database=citus;Port=9700;Password=citus;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60", diff --git a/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs b/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs index 6ecc474d1..ceae56077 100644 --- a/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs +++ b/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs @@ -124,7 +124,20 @@ public partial class ActivityExecutionContext : IExecutionContext, IDisposable { var containerVariables = (Activity as IVariableContainer)?.Variables ?? Enumerable.Empty(); var dynamicVariables = DynamicVariables; - return containerVariables.Concat(dynamicVariables).DistinctBy(x => x.Name); + var mergedVariables = new Dictionary(); + + foreach (var containerVariable in containerVariables) + { + var name = !string.IsNullOrEmpty(containerVariable.Name) ? containerVariable.Name : containerVariable.Id; + mergedVariables[name] = containerVariable; + } + + foreach (var dynamicVariable in dynamicVariables) + { + var name = !string.IsNullOrEmpty(dynamicVariable.Name) ? dynamicVariable.Name : dynamicVariable.Id; + mergedVariables[name] = dynamicVariable; + } + return mergedVariables.Values; } } diff --git a/src/modules/Elsa.Workflows.Core/Memory/Variable.cs b/src/modules/Elsa.Workflows.Core/Memory/Variable.cs index 78b577070..d3ed28f2f 100644 --- a/src/modules/Elsa.Workflows.Core/Memory/Variable.cs +++ b/src/modules/Elsa.Workflows.Core/Memory/Variable.cs @@ -21,7 +21,7 @@ public class Variable : MemoryBlockReference } /// - public Variable(string name, object? value = default) : this() + public Variable(string name, object? value = null) : this() { Name = name; Value = value; @@ -30,7 +30,7 @@ public class Variable : MemoryBlockReference /// /// The name of the variable. /// - public string Name { get; set; } = default!; + public string Name { get; set; } = null!; /// /// A default value for the variable. @@ -89,6 +89,12 @@ public class Variable : Variable StorageDriverType = typeof(TDriver); return this; } + + public Variable WithId(string id) + { + Id = id; + return this; + } } ///