Add SQL Server example
This commit is contained in:
parent
7356bf10c8
commit
98fe6d21d7
|
|
@ -118,6 +118,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample21", "src\samples\Sam
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Dashboard.Web", "src\dashboard\Elsa.Dashboard.Web\Elsa.Dashboard.Web.csproj", "{AE0363D2-3630-4CDD-86A1-7D6A717361BD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample22", "src\samples\Sample22\Sample22.csproj", "{BE634D4E-73A1-48CE-8682-F548CA0BA5B6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -300,6 +302,10 @@ Global
|
|||
{AE0363D2-3630-4CDD-86A1-7D6A717361BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE0363D2-3630-4CDD-86A1-7D6A717361BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE0363D2-3630-4CDD-86A1-7D6A717361BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BE634D4E-73A1-48CE-8682-F548CA0BA5B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BE634D4E-73A1-48CE-8682-F548CA0BA5B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BE634D4E-73A1-48CE-8682-F548CA0BA5B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BE634D4E-73A1-48CE-8682-F548CA0BA5B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -356,6 +362,7 @@ Global
|
|||
{9B238B75-5A68-48B1-973A-59F0EFAB0A8B} = {5E5E1E84-DDBC-40D6-B891-0D563A15A44A}
|
||||
{6BA81F4E-2B17-4C7B-ACB1-6588B0315582} = {5E5E1E84-DDBC-40D6-B891-0D563A15A44A}
|
||||
{AE0363D2-3630-4CDD-86A1-7D6A717361BD} = {0DF567E8-2A21-4A1C-90E8-025F1EC615F3}
|
||||
{BE634D4E-73A1-48CE-8682-F548CA0BA5B6} = {5E5E1E84-DDBC-40D6-B891-0D563A15A44A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8B0975FD-7050-48B0-88C5-48C33378E158}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@
|
|||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=CONNECTIONSTRING/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
|
|
@ -1,143 +1,143 @@
|
|||
using System.Collections.Generic;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.JsonNet;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore
|
||||
{
|
||||
public class ElsaContext : DbContext
|
||||
{
|
||||
private readonly JsonSerializerSettings serializerSettings;
|
||||
|
||||
public ElsaContext(DbContextOptions<ElsaContext> options) : base(options)
|
||||
{
|
||||
serializerSettings = new JsonSerializerSettings().ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
||||
}
|
||||
|
||||
public DbSet<WorkflowDefinitionVersionEntity> WorkflowDefinitionVersions { get; set; }
|
||||
public DbSet<WorkflowInstanceEntity> WorkflowInstances { get; set; }
|
||||
public DbSet<ActivityDefinitionEntity> ActivityDefinitions { get; set; }
|
||||
public DbSet<ConnectionDefinitionEntity> ConnectionDefinitions { get; set; }
|
||||
public DbSet<ActivityInstanceEntity> ActivityInstances { get; set; }
|
||||
public DbSet<BlockingActivityEntity> BlockingActivities { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
ConfigureWorkflowDefinitionVersion(modelBuilder);
|
||||
ConfigureWorkflowInstance(modelBuilder);
|
||||
ConfigureActivityDefinition(modelBuilder);
|
||||
ConfigureActivityInstance(modelBuilder);
|
||||
ConfigureBlockingActivity(modelBuilder);
|
||||
}
|
||||
|
||||
private void ConfigureWorkflowDefinitionVersion(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<WorkflowDefinitionVersionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
entity.Property(x => x.DefinitionId);
|
||||
entity.Property(x => x.Variables).HasConversion(x => Serialize(x), x => Deserialize<Variables>(x));
|
||||
entity.HasMany(x => x.Activities).WithOne(x => x.WorkflowDefinitionVersion);
|
||||
entity.HasMany(x => x.Connections).WithOne(x => x.WorkflowDefinitionVersion);
|
||||
}
|
||||
|
||||
private void ConfigureWorkflowInstance(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<WorkflowInstanceEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
entity.Property(x => x.Status).HasConversion<string>();
|
||||
|
||||
entity
|
||||
.Property(x => x.Scopes)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<Stack<WorkflowExecutionScope>>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.ExecutionLog)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<ICollection<LogEntry>>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.Fault)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<WorkflowFault>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.Input)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<Variables>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.HasMany(x => x.Activities)
|
||||
.WithOne(x => x.WorkflowInstance);
|
||||
|
||||
entity
|
||||
.HasMany(x => x.BlockingActivities)
|
||||
.WithOne(x => x.WorkflowInstance);
|
||||
}
|
||||
|
||||
private void ConfigureActivityDefinition(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ActivityDefinitionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
|
||||
entity
|
||||
.Property(x => x.State)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
}
|
||||
|
||||
private void ConfigureConnectionDefinition(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ConnectionDefinitionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
}
|
||||
|
||||
private void ConfigureActivityInstance(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ActivityInstanceEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
|
||||
entity
|
||||
.Property(x => x.State)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
|
||||
entity
|
||||
.Property(x => x.Output)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
}
|
||||
|
||||
private void ConfigureBlockingActivity(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<BlockingActivityEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
}
|
||||
|
||||
private string Serialize(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, serializerSettings);
|
||||
}
|
||||
|
||||
private T Deserialize<T>(string json)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(json, serializerSettings);
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.JsonNet;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
||||
{
|
||||
public class ElsaContext : DbContext
|
||||
{
|
||||
private readonly JsonSerializerSettings serializerSettings;
|
||||
|
||||
public ElsaContext(DbContextOptions<ElsaContext> options) : base(options)
|
||||
{
|
||||
serializerSettings = new JsonSerializerSettings().ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
||||
}
|
||||
|
||||
public DbSet<WorkflowDefinitionVersionEntity> WorkflowDefinitionVersions { get; set; }
|
||||
public DbSet<WorkflowInstanceEntity> WorkflowInstances { get; set; }
|
||||
public DbSet<ActivityDefinitionEntity> ActivityDefinitions { get; set; }
|
||||
public DbSet<ConnectionDefinitionEntity> ConnectionDefinitions { get; set; }
|
||||
public DbSet<ActivityInstanceEntity> ActivityInstances { get; set; }
|
||||
public DbSet<BlockingActivityEntity> BlockingActivities { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
ConfigureWorkflowDefinitionVersion(modelBuilder);
|
||||
ConfigureWorkflowInstance(modelBuilder);
|
||||
ConfigureActivityDefinition(modelBuilder);
|
||||
ConfigureActivityInstance(modelBuilder);
|
||||
ConfigureBlockingActivity(modelBuilder);
|
||||
}
|
||||
|
||||
private void ConfigureWorkflowDefinitionVersion(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<WorkflowDefinitionVersionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
entity.Property(x => x.DefinitionId);
|
||||
entity.Property(x => x.Variables).HasConversion(x => Serialize(x), x => Deserialize<Variables>(x));
|
||||
entity.HasMany(x => x.Activities).WithOne(x => x.WorkflowDefinitionVersion);
|
||||
entity.HasMany(x => x.Connections).WithOne(x => x.WorkflowDefinitionVersion);
|
||||
}
|
||||
|
||||
private void ConfigureWorkflowInstance(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<WorkflowInstanceEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
entity.Property(x => x.Status).HasConversion<string>();
|
||||
|
||||
entity
|
||||
.Property(x => x.Scopes)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<Stack<WorkflowExecutionScope>>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.ExecutionLog)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<ICollection<LogEntry>>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.Fault)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<WorkflowFault>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.Property(x => x.Input)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<Variables>(x)
|
||||
);
|
||||
|
||||
entity
|
||||
.HasMany(x => x.Activities)
|
||||
.WithOne(x => x.WorkflowInstance);
|
||||
|
||||
entity
|
||||
.HasMany(x => x.BlockingActivities)
|
||||
.WithOne(x => x.WorkflowInstance);
|
||||
}
|
||||
|
||||
private void ConfigureActivityDefinition(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ActivityDefinitionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
|
||||
entity
|
||||
.Property(x => x.State)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
}
|
||||
|
||||
private void ConfigureConnectionDefinition(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ConnectionDefinitionEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
}
|
||||
|
||||
private void ConfigureActivityInstance(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<ActivityInstanceEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
|
||||
entity
|
||||
.Property(x => x.State)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
|
||||
entity
|
||||
.Property(x => x.Output)
|
||||
.HasConversion(x => Serialize(x), x => Deserialize<JObject>(x));
|
||||
}
|
||||
|
||||
private void ConfigureBlockingActivity(ModelBuilder modelBuilder)
|
||||
{
|
||||
var entity = modelBuilder.Entity<BlockingActivityEntity>();
|
||||
|
||||
entity.HasKey(x => x.Id);
|
||||
}
|
||||
|
||||
private string Serialize(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, serializerSettings);
|
||||
}
|
||||
|
||||
private T Deserialize<T>(string json)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(json, serializerSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
||||
{
|
||||
public class SqlServerContext : ElsaContext
|
||||
{
|
||||
public SqlServerContext(DbContextOptions<ElsaContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
||||
{
|
||||
public class SqlServerContextFactory : IDesignTimeDbContextFactory<SqlServerContext>
|
||||
{
|
||||
public SqlServerContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ElsaContext>();
|
||||
var migrationAssembly = typeof(ElsaContext).Assembly.FullName;
|
||||
var connectionString = Environment.GetEnvironmentVariable("EF_CONNECTIONSTRING");
|
||||
|
||||
if(connectionString == null)
|
||||
throw new InvalidOperationException("Set the EF_CONNECTIONSTRING environment variable to a valid SQL Server connection string. E.g. SET EF_CONNECTIONSTRING=Server=localhost;Database=Elsa;User=sa;Password=Secret_password123!;");
|
||||
|
||||
optionsBuilder.UseSqlServer(
|
||||
connectionString,
|
||||
x => x.MigrationsAssembly(migrationAssembly)
|
||||
);
|
||||
|
||||
return new SqlServerContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
||||
{
|
||||
public class SqliteContext : ElsaContext
|
||||
{
|
||||
public SqliteContext(DbContextOptions<ElsaContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
||||
{
|
||||
public class SqliteContextFactory : IDesignTimeDbContextFactory<SqliteContext>
|
||||
{
|
||||
public SqliteContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ElsaContext>();
|
||||
var migrationAssembly = typeof(ElsaContext).Assembly.FullName;
|
||||
var connectionString = Environment.GetEnvironmentVariable("EF_CONNECTIONSTRING");
|
||||
|
||||
if(connectionString == null)
|
||||
throw new InvalidOperationException(@"Set the EF_CONNECTIONSTRING environment variable to a valid SQLite connection string. E.g. SET EF_CONNECTIONSTRING=Data Source=c:\data\elsa.db;Cache=Shared;");
|
||||
|
||||
optionsBuilder.UseSqlite(
|
||||
connectionString,
|
||||
x => x.MigrationsAssembly(migrationAssembly)
|
||||
);
|
||||
|
||||
return new SqliteContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore
|
||||
{
|
||||
public class DesignTimeElsaContextFactory : IDesignTimeDbContextFactory<ElsaContext>
|
||||
{
|
||||
public ElsaContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ElsaContext>();
|
||||
var migrationAssembly = typeof(DesignTimeElsaContextFactory).Assembly.FullName;
|
||||
var provider = Environment.GetEnvironmentVariable("EF_PROVIDER") ?? "Sqlite";
|
||||
var connectionString = Environment.GetEnvironmentVariable("EF_CONNECTIONSTRING") ?? "Data Source=c:\\data\\elsa.db;Cache=Shared";
|
||||
|
||||
switch (provider)
|
||||
{
|
||||
case "Sqlite":
|
||||
optionsBuilder.UseSqlite(
|
||||
connectionString,
|
||||
x => x.MigrationsAssembly(migrationAssembly)
|
||||
);
|
||||
break;
|
||||
case "SqlServer":
|
||||
optionsBuilder.UseSqlServer(
|
||||
connectionString,
|
||||
x => x.MigrationsAssembly(migrationAssembly)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("The specified provider is not supported.");
|
||||
}
|
||||
|
||||
return new ElsaContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Elsa.AutoMapper.Extensions;
|
||||
using Elsa.AutoMapper.Extensions.NodaTime;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Mapping;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,261 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.SqlServer
|
||||
{
|
||||
[DbContext(typeof(SqlServerContext))]
|
||||
[Migration("20191126215035_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Left")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Top")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowDefinitionVersionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowDefinitionVersionId");
|
||||
|
||||
b.ToTable("ActivityDefinitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Output")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowInstanceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowInstanceId");
|
||||
|
||||
b.ToTable("ActivityInstances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.BlockingActivityEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ActivityType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowInstanceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowInstanceId");
|
||||
|
||||
b.ToTable("BlockingActivities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ConnectionDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("DestinationActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Outcome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SourceActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowDefinitionVersionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowDefinitionVersionId");
|
||||
|
||||
b.ToTable("ConnectionDefinitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDisabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsLatest")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsSingleton")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Variables")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("VersionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorkflowDefinitionVersions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime?>("AbortedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CorrelationId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ExecutionLog")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Fault")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("FaultedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("FinishedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Input")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("InstanceId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Scopes")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorkflowInstances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", "WorkflowDefinitionVersion")
|
||||
.WithMany("Activities")
|
||||
.HasForeignKey("WorkflowDefinitionVersionId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityInstanceEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", "WorkflowInstance")
|
||||
.WithMany("Activities")
|
||||
.HasForeignKey("WorkflowInstanceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.BlockingActivityEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", "WorkflowInstance")
|
||||
.WithMany("BlockingActivities")
|
||||
.HasForeignKey("WorkflowInstanceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ConnectionDefinitionEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", "WorkflowDefinitionVersion")
|
||||
.WithMany("Connections")
|
||||
.HasForeignKey("WorkflowDefinitionVersionId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.SqlServer
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkflowDefinitionVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
VersionId = table.Column<string>(nullable: true),
|
||||
DefinitionId = table.Column<string>(nullable: true),
|
||||
Version = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
Variables = table.Column<string>(nullable: true),
|
||||
IsSingleton = table.Column<bool>(nullable: false),
|
||||
IsDisabled = table.Column<bool>(nullable: false),
|
||||
IsPublished = table.Column<bool>(nullable: false),
|
||||
IsLatest = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkflowDefinitionVersions", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkflowInstances",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
InstanceId = table.Column<string>(nullable: true),
|
||||
DefinitionId = table.Column<string>(nullable: true),
|
||||
Version = table.Column<int>(nullable: false),
|
||||
Status = table.Column<string>(nullable: false),
|
||||
CorrelationId = table.Column<string>(nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(nullable: false),
|
||||
StartedAt = table.Column<DateTime>(nullable: true),
|
||||
FinishedAt = table.Column<DateTime>(nullable: true),
|
||||
FaultedAt = table.Column<DateTime>(nullable: true),
|
||||
AbortedAt = table.Column<DateTime>(nullable: true),
|
||||
Scopes = table.Column<string>(nullable: true),
|
||||
Input = table.Column<string>(nullable: true),
|
||||
ExecutionLog = table.Column<string>(nullable: true),
|
||||
Fault = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkflowInstances", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ActivityDefinitions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ActivityId = table.Column<string>(nullable: true),
|
||||
WorkflowDefinitionVersionId = table.Column<int>(nullable: true),
|
||||
Type = table.Column<string>(nullable: true),
|
||||
Left = table.Column<int>(nullable: false),
|
||||
Top = table.Column<int>(nullable: false),
|
||||
State = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ActivityDefinitions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ActivityDefinitions_WorkflowDefinitionVersions_WorkflowDefinitionVersionId",
|
||||
column: x => x.WorkflowDefinitionVersionId,
|
||||
principalTable: "WorkflowDefinitionVersions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ConnectionDefinitions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WorkflowDefinitionVersionId = table.Column<int>(nullable: true),
|
||||
SourceActivityId = table.Column<string>(nullable: true),
|
||||
DestinationActivityId = table.Column<string>(nullable: true),
|
||||
Outcome = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ConnectionDefinitions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ConnectionDefinitions_WorkflowDefinitionVersions_WorkflowDefinitionVersionId",
|
||||
column: x => x.WorkflowDefinitionVersionId,
|
||||
principalTable: "WorkflowDefinitionVersions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ActivityInstances",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ActivityId = table.Column<string>(nullable: true),
|
||||
WorkflowInstanceId = table.Column<int>(nullable: true),
|
||||
Type = table.Column<string>(nullable: true),
|
||||
State = table.Column<string>(nullable: true),
|
||||
Output = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ActivityInstances", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ActivityInstances_WorkflowInstances_WorkflowInstanceId",
|
||||
column: x => x.WorkflowInstanceId,
|
||||
principalTable: "WorkflowInstances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BlockingActivities",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WorkflowInstanceId = table.Column<int>(nullable: true),
|
||||
ActivityId = table.Column<string>(nullable: true),
|
||||
ActivityType = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BlockingActivities", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BlockingActivities_WorkflowInstances_WorkflowInstanceId",
|
||||
column: x => x.WorkflowInstanceId,
|
||||
principalTable: "WorkflowInstances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActivityDefinitions_WorkflowDefinitionVersionId",
|
||||
table: "ActivityDefinitions",
|
||||
column: "WorkflowDefinitionVersionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActivityInstances_WorkflowInstanceId",
|
||||
table: "ActivityInstances",
|
||||
column: "WorkflowInstanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BlockingActivities_WorkflowInstanceId",
|
||||
table: "BlockingActivities",
|
||||
column: "WorkflowInstanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ConnectionDefinitions_WorkflowDefinitionVersionId",
|
||||
table: "ConnectionDefinitions",
|
||||
column: "WorkflowDefinitionVersionId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ActivityDefinitions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ActivityInstances");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BlockingActivities");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ConnectionDefinitions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkflowInstances");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkflowDefinitionVersions");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.SqlServer
|
||||
{
|
||||
[DbContext(typeof(SqlServerContext))]
|
||||
partial class SqlServerContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Left")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Top")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowDefinitionVersionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowDefinitionVersionId");
|
||||
|
||||
b.ToTable("ActivityDefinitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Output")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowInstanceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowInstanceId");
|
||||
|
||||
b.ToTable("ActivityInstances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.BlockingActivityEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ActivityType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowInstanceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowInstanceId");
|
||||
|
||||
b.ToTable("BlockingActivities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ConnectionDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("DestinationActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Outcome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SourceActivityId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WorkflowDefinitionVersionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkflowDefinitionVersionId");
|
||||
|
||||
b.ToTable("ConnectionDefinitions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDisabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsLatest")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsSingleton")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Variables")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("VersionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorkflowDefinitionVersions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime?>("AbortedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CorrelationId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ExecutionLog")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Fault")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("FaultedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("FinishedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Input")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("InstanceId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Scopes")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorkflowInstances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", "WorkflowDefinitionVersion")
|
||||
.WithMany("Activities")
|
||||
.HasForeignKey("WorkflowDefinitionVersionId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityInstanceEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", "WorkflowInstance")
|
||||
.WithMany("Activities")
|
||||
.HasForeignKey("WorkflowInstanceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.BlockingActivityEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", "WorkflowInstance")
|
||||
.WithMany("BlockingActivities")
|
||||
.HasForeignKey("WorkflowInstanceId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ConnectionDefinitionEntity", b =>
|
||||
{
|
||||
b.HasOne("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", "WorkflowDefinitionVersion")
|
||||
.WithMany("Connections")
|
||||
.HasForeignKey("WorkflowDefinitionVersionId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +1,27 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(ElsaContext))]
|
||||
[Migration("20191116105145_InitialCreate")]
|
||||
[DbContext(typeof(SqliteContext))]
|
||||
[Migration("20191126211902_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.0.0");
|
||||
.HasAnnotation("ProductVersion", "3.0.1");
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
|
|
@ -126,6 +127,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
|
|
@ -166,6 +168,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("AbortedAt")
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
|
|
@ -11,7 +11,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
name: "WorkflowDefinitionVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
VersionId = table.Column<string>(nullable: true),
|
||||
DefinitionId = table.Column<string>(nullable: true),
|
||||
Version = table.Column<int>(nullable: false),
|
||||
|
|
@ -32,7 +33,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
name: "WorkflowInstances",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
InstanceId = table.Column<string>(nullable: true),
|
||||
DefinitionId = table.Column<string>(nullable: true),
|
||||
Version = table.Column<int>(nullable: false),
|
||||
|
|
@ -57,7 +59,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
name: "ActivityDefinitions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ActivityId = table.Column<string>(nullable: true),
|
||||
WorkflowDefinitionVersionId = table.Column<int>(nullable: true),
|
||||
Type = table.Column<string>(nullable: true),
|
||||
|
|
@ -1,22 +1,25 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
||||
namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(ElsaContext))]
|
||||
partial class ElsaContextModelSnapshot : ModelSnapshot
|
||||
[DbContext(typeof(SqliteContext))]
|
||||
partial class SqliteContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.0.0");
|
||||
.HasAnnotation("ProductVersion", "3.0.1");
|
||||
|
||||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ActivityId")
|
||||
|
|
@ -122,6 +125,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowDefinitionVersionEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
|
|
@ -162,6 +166,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations
|
|||
modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.WorkflowInstanceEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("AbortedAt")
|
||||
|
|
@ -1,9 +1,26 @@
|
|||
# Generating migrations
|
||||
|
||||
We should generate migration sets per provider as described here: https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli
|
||||
|
||||
Example commands:
|
||||
|
||||
```bash
|
||||
dotnet ef migrations add InitialCreate --context SqliteContext --output-dir Migrations/Sqlite
|
||||
dotnet ef migrations add InitialCreate --context SqlServerContext --output-dir Migrations/SqlServer
|
||||
```
|
||||
|
||||
|
||||
# Creating and updating the Sqlite database
|
||||
|
||||
To create the database, run the following command from a shell:
|
||||
First, set the appropriate connection string.
|
||||
To create the database, run the migrations.
|
||||
|
||||
Example command:
|
||||
|
||||
```bash
|
||||
dotnet ef database update
|
||||
```
|
||||
SET EF_CONNECTIONSTRING="Data Source=c:\data\elsa.db;Cache=Shared"
|
||||
dotnet ef database update --context SqliteContext
|
||||
|
||||
> NOTE: By default, the SqLite provider is used, and will create a database called `elsa.db` in folder `c:\data`. You will have to create this folder manually if it doesn't exist.
|
||||
SET EF_CONNECTIONSTRING="Server=localhost;Database=Elsa;User=sa;Password=Secret_password123!;"
|
||||
dotnet ef database update --context SqlServerContext
|
||||
```
|
||||
|
|
@ -4,6 +4,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Entities;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||
using AutoMapper;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [__EFMigrationsHistory] (
|
||||
[MigrationId] nvarchar(150) NOT NULL,
|
||||
[ProductVersion] nvarchar(32) NOT NULL,
|
||||
CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId])
|
||||
);
|
||||
END;
|
||||
|
||||
GO
|
||||
|
||||
CREATE TABLE [WorkflowDefinitionVersions] (
|
||||
[Id] nvarchar(450) NOT NULL,
|
||||
[DefinitionId] nvarchar(max) NULL,
|
||||
[Version] int NOT NULL,
|
||||
[Name] nvarchar(max) NULL,
|
||||
[Description] nvarchar(max) NULL,
|
||||
[Activities] nvarchar(max) NULL,
|
||||
[Connections] nvarchar(max) NULL,
|
||||
[Variables] nvarchar(max) NULL,
|
||||
[IsSingleton] bit NOT NULL,
|
||||
[IsDisabled] bit NOT NULL,
|
||||
[IsPublished] bit NOT NULL,
|
||||
[IsLatest] bit NOT NULL,
|
||||
CONSTRAINT [PK_WorkflowDefinitionVersions] PRIMARY KEY ([Id])
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
CREATE TABLE [WorkflowInstances] (
|
||||
[Id] nvarchar(450) NOT NULL,
|
||||
[DefinitionId] nvarchar(max) NULL,
|
||||
[Version] int NOT NULL,
|
||||
[Status] nvarchar(max) NOT NULL,
|
||||
[CorrelationId] nvarchar(max) NULL,
|
||||
[CreatedAt] datetime2 NOT NULL,
|
||||
[StartedAt] datetime2 NULL,
|
||||
[FinishedAt] datetime2 NULL,
|
||||
[FaultedAt] datetime2 NULL,
|
||||
[AbortedAt] datetime2 NULL,
|
||||
[Activities] nvarchar(max) NULL,
|
||||
[Scopes] nvarchar(max) NULL,
|
||||
[Input] nvarchar(max) NULL,
|
||||
[BlockingActivities] nvarchar(max) NULL,
|
||||
[ExecutionLog] nvarchar(max) NULL,
|
||||
[Fault] nvarchar(max) NULL,
|
||||
CONSTRAINT [PK_WorkflowInstances] PRIMARY KEY ([Id])
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20190929143746_InitialCreate', N'2.2.6-servicing-10079');
|
||||
|
||||
GO
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Elsa.Extensions;
|
|||
using Elsa.Models;
|
||||
using Elsa.Persistence;
|
||||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Extensions;
|
||||
using Elsa.Runtime;
|
||||
using Elsa.Services;
|
||||
|
|
|
|||
16
src/samples/Sample22/HelloWorldWorkflow.cs
Normal file
16
src/samples/Sample22/HelloWorldWorkflow.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using Elsa.Activities.Console.Activities;
|
||||
using Elsa.Expressions;
|
||||
using Elsa.Services;
|
||||
using Elsa.Services.Models;
|
||||
|
||||
namespace Sample22
|
||||
{
|
||||
public class HelloWorldWorkflow : IWorkflow
|
||||
{
|
||||
public void Build(IWorkflowBuilder builder)
|
||||
{
|
||||
builder
|
||||
.StartWith<WriteLine>(activity => activity.TextExpression = new LiteralExpression("Hello World!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
78
src/samples/Sample22/Program.cs
Normal file
78
src/samples/Sample22/Program.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Elsa.Activities.Console.Extensions;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence;
|
||||
using Elsa.Persistence.EntityFrameworkCore;
|
||||
using Elsa.Persistence.EntityFrameworkCore.DbContexts;
|
||||
using Elsa.Persistence.EntityFrameworkCore.Extensions;
|
||||
using Elsa.Runtime;
|
||||
using Elsa.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Sample22
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple demonstration of using Entity Framework Core persistence providers with SQL Server.
|
||||
/// To run the EF migration, run the command: `dotnet ef database update` within the context of the "Elsa.Persistence.EntityFrameworkCore" project root.
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var services = BuildServices();
|
||||
|
||||
// Create a workflow definition.
|
||||
var registry = services.GetService<IWorkflowRegistry>();
|
||||
var workflowDefinition = await registry.GetWorkflowDefinitionAsync<HelloWorldWorkflow>();
|
||||
|
||||
// Mark this definition as the "latest" version.
|
||||
workflowDefinition.IsLatest = true;
|
||||
workflowDefinition.Version = 1;
|
||||
|
||||
using var scope = services.CreateScope();
|
||||
var dbContext = scope.ServiceProvider.GetRequiredService<ElsaContext>();
|
||||
|
||||
// Ensure DB exists.
|
||||
await dbContext.Database.EnsureCreatedAsync();
|
||||
|
||||
// Persist the workflow definition.
|
||||
var definitionStore = scope.ServiceProvider.GetRequiredService<IWorkflowDefinitionStore>();
|
||||
await definitionStore.SaveAsync(workflowDefinition);
|
||||
|
||||
// Flush to DB.
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
// Load the workflow definition.
|
||||
workflowDefinition = await definitionStore.GetByIdAsync(
|
||||
workflowDefinition.DefinitionId,
|
||||
VersionOptions.Latest);
|
||||
|
||||
// Execute the workflow.
|
||||
var invoker = scope.ServiceProvider.GetRequiredService<IWorkflowInvoker>();
|
||||
var executionContext = await invoker.StartAsync(workflowDefinition);
|
||||
|
||||
// Persist the workflow instance.
|
||||
var instanceStore = scope.ServiceProvider.GetRequiredService<IWorkflowInstanceStore>();
|
||||
var workflowInstance = executionContext.Workflow.ToInstance();
|
||||
await instanceStore.SaveAsync(workflowInstance);
|
||||
|
||||
// Flush to DB.
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private static IServiceProvider BuildServices()
|
||||
{
|
||||
return new ServiceCollection()
|
||||
.AddElsa(
|
||||
x => x.AddEntityFrameworkStores(
|
||||
options => options
|
||||
.UseSqlServer(@"Server=localhost;Database=Elsa;User=sa;Password=Secret_password123!;")))
|
||||
.AddConsoleActivities()
|
||||
.AddWorkflow<HelloWorldWorkflow>()
|
||||
.BuildServiceProvider();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/samples/Sample22/Sample22.csproj
Normal file
19
src/samples/Sample22/Sample22.csproj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\core\Elsa\Elsa.csproj" />
|
||||
<ProjectReference Include="..\..\persistence\Elsa.Persistence.EntityFrameworkCore\Elsa.Persistence.EntityFrameworkCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
src/samples/Sample22/docker-compose.yaml
Normal file
10
src/samples/Sample22/docker-compose.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
version: '3.7'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: "mcr.microsoft.com/mssql/server:2017-latest"
|
||||
ports:
|
||||
- "1433:1433"
|
||||
environment:
|
||||
SA_PASSWORD: "Secret_password123!"
|
||||
ACCEPT_EULA: "Y"
|
||||
Loading…
Reference in a new issue