Use in-memory persistence by default

This commit is contained in:
Sipke Schoorstra 2020-12-12 14:07:17 +01:00
parent daa10df6c3
commit f2aae986f4
68 changed files with 105 additions and 219 deletions

View file

@ -90,8 +90,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Activities.AzureServic
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "persistence", "persistence", "{5619F343-A270-4E31-9C52-7C85A4DD6D71}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Persistence.InMemory", "src\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj", "{BA9EE5A2-632F-4489-B59D-C7283960BCCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.YesSql", "src\persistence\Elsa.Persistence.YesSql\Elsa.Persistence.YesSql.csproj", "{7E14324E-7AD3-4498-AECE-C7B80FB691BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Persistence.MongoDb", "src\persistence\Elsa.Persistence.MongoDb\Elsa.Persistence.MongoDb.csproj", "{09718131-4D0E-4EF3-B3FB-116EBE1D8702}"
@ -274,10 +272,6 @@ Global
{DD607BC1-F9D9-4685-BC8F-A4056C2C31FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD607BC1-F9D9-4685-BC8F-A4056C2C31FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD607BC1-F9D9-4685-BC8F-A4056C2C31FA}.Release|Any CPU.Build.0 = Release|Any CPU
{BA9EE5A2-632F-4489-B59D-C7283960BCCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA9EE5A2-632F-4489-B59D-C7283960BCCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA9EE5A2-632F-4489-B59D-C7283960BCCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA9EE5A2-632F-4489-B59D-C7283960BCCA}.Release|Any CPU.Build.0 = Release|Any CPU
{7E14324E-7AD3-4498-AECE-C7B80FB691BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E14324E-7AD3-4498-AECE-C7B80FB691BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E14324E-7AD3-4498-AECE-C7B80FB691BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -432,7 +426,6 @@ Global
{AEA00027-F280-43A4-AC60-E2AF3014CF34} = {E42743A0-FBDD-4150-9D53-6000496D9B87}
{E0090EF3-C4A7-4262-9300-1D395BE25DD0} = {22E75696-6FE9-436A-9097-EE21C603F818}
{38429825-88AF-4F0D-9E7C-A58EC5C86DA0} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925}
{BA9EE5A2-632F-4489-B59D-C7283960BCCA} = {38429825-88AF-4F0D-9E7C-A58EC5C86DA0}
{09718131-4D0E-4EF3-B3FB-116EBE1D8702} = {38429825-88AF-4F0D-9E7C-A58EC5C86DA0}
{7E14324E-7AD3-4498-AECE-C7B80FB691BC} = {38429825-88AF-4F0D-9E7C-A58EC5C86DA0}
{164EB38A-D6D2-4092-8835-C944ECEE357C} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925}

View file

@ -4,4 +4,5 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=src_005Cweb_005Cmodules_005CFlowsharp_002EWeb_002EViewComponents_005CClientApp_005Cnode_005Fmodules/@EntryIndexedValue"></s:String>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=src_005Cweb_005Cmodules_005CFlowsharp_002EWeb_002EViewComponents_005CClientApp_005Cnode_005Fmodules/@EntryIndexRemoved">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=src_005Cweb_005Cmodules_005CFlowsharp_002EWeb_002EViewComponents_005CAssets_005Cnode_005Fmodules/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Configurer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Materializer/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View file

@ -2,6 +2,8 @@ using System;
using Elsa.Caching;
using Elsa.DistributedLock;
using Elsa.Extensions;
using Elsa.Persistence;
using Elsa.Persistence.InMemory;
using Elsa.Serialization;
using Elsa.Services;
using Microsoft.Extensions.DependencyInjection;
@ -22,6 +24,8 @@ namespace Elsa
{
Services = services;
WorkflowDefinitionStoreFactory = _ => new InMemoryWorkflowDefinitionStore();
WorkflowInstanceStoreFactory = _ => new InMemoryWorkflowInstanceStore();
StorageFactory = sp => Storage.Net.StorageFactory.Blobs.InMemory();
DistributedLockProviderFactory = sp => new DefaultLockProvider();
SignalFactory = sp => new Signal();
@ -49,6 +53,8 @@ namespace Elsa
public IServiceCollection Services { get; }
internal Func<IServiceProvider, IBlobStorage> StorageFactory { get; set; }
internal Func<IServiceProvider, IWorkflowDefinitionStore> WorkflowDefinitionStoreFactory { get; set; }
internal Func<IServiceProvider, IWorkflowInstanceStore> WorkflowInstanceStoreFactory { get; set; }
internal Func<IServiceProvider, IDistributedLockProvider> DistributedLockProviderFactory { get; private set; }
internal Func<IServiceProvider, ISignal> SignalFactory { get; private set; }
internal Func<IServiceProvider, JsonSerializer> CreateJsonSerializer { get; private set; }
@ -75,6 +81,18 @@ namespace Elsa
StorageFactory = factory;
return this;
}
public ElsaOptions UseWorkflowDefinitionStore(Func<IServiceProvider, IWorkflowDefinitionStore> factory)
{
WorkflowDefinitionStoreFactory = factory;
return this;
}
public ElsaOptions UseWorkflowInstanceStore(Func<IServiceProvider, IWorkflowInstanceStore> factory)
{
WorkflowInstanceStoreFactory = factory;
return this;
}
public ElsaOptions UseAutoMapper(Action addAutoMapper)
{

View file

@ -40,6 +40,8 @@ namespace Microsoft.Extensions.DependencyInjection
services
.AddSingleton(options)
.AddScoped(options.WorkflowDefinitionStoreFactory)
.AddScoped(options.WorkflowInstanceStoreFactory)
.AddSingleton(options.DistributedLockProviderFactory)
.AddSingleton(options.SignalFactory)
.AddSingleton(options.StorageFactory);
@ -105,6 +107,7 @@ namespace Microsoft.Extensions.DependencyInjection
.AddSingleton<IActivityTypeProvider, TypeBasedActivityProvider>()
.AddWorkflowProvider<ProgrammaticWorkflowProvider>()
.AddWorkflowProvider<StorageWorkflowProvider>()
.AddWorkflowProvider<DatabaseWorkflowProvider>()
.AddTransient<IWorkflowBuilder, WorkflowBuilder>()
.AddTransient<ICompositeActivityBuilder, CompositeActivityBuilder>()
.AddTransient<Func<IWorkflowBuilder>>(sp => sp.GetRequiredService<IWorkflowBuilder>)

View file

@ -1,33 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<RootNamespace>Elsa.Persistence.InMemory</RootNamespace>
<PackageVersion>1.0.0</PackageVersion>
<Authors>Elsa Contributors</Authors>
<Description>
Elsa is a set of workflow libraries and tools that enable super-fast workflowing capabilities in any .NET Core application.
This package provides a InMemory persistence provider.
</Description>
<Copyright>2020</Copyright>
<PackageProjectUrl>https://github.com/elsa-workflows/elsa-core</PackageProjectUrl>
<RepositoryUrl>https://github.com/elsa-workflows/elsa-core</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<PackageTags>elsa, workflows, orchard</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png">
<Pack>True</Pack>
<PackagePath />
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\Elsa.Core\Elsa.Core.csproj" />
</ItemGroup>
</Project>

View file

@ -1,19 +0,0 @@
using Elsa.WorkflowProviders;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Persistence.InMemory
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddElsaPersistenceInMemory(this IServiceCollection services)
{
// Scoped, because IMediator is registered as Scoped and IIdGenerator could also be registered as Scoped
services.AddScoped<IWorkflowDefinitionStore, InMemoryWorkflowDefinitionStore>()
.AddScoped<IWorkflowInstanceStore, InMemoryWorkflowInstanceStore>()
.AddWorkflowProvider<DatabaseWorkflowProvider>();
return services;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -1,4 +1,5 @@
using System;
using Elsa.Extensions;
using Elsa.Persistence.MongoDb.Services;
using Elsa.Runtime;
using Elsa.WorkflowProviders;
@ -9,31 +10,35 @@ namespace Elsa.Persistence.MongoDb
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddElsaPersistenceMongoDb(this IServiceCollection services, Action<ElsaMongoDbOptions> configureOptions)
public static ElsaOptions UseMongoDbPersistence(this ElsaOptions elsa, Action<ElsaMongoDbOptions> configureOptions)
{
AddCore(services);
services.Configure(configureOptions);
AddCore(elsa);
elsa.Services.Configure(configureOptions);
return services;
return elsa;
}
public static IServiceCollection AddElsaPersistenceMongoDb(this IServiceCollection services, IConfiguration options)
public static ElsaOptions UseMongoDbPersistence(this ElsaOptions elsa, IConfiguration options)
{
AddCore(services);
services.Configure<ElsaMongoDbOptions>(options);
return services;
AddCore(elsa);
elsa.Services.Configure<ElsaMongoDbOptions>(options);
return elsa;
}
private static void AddCore(IServiceCollection services)
private static void AddCore(ElsaOptions elsa)
{
services.AddScoped<IWorkflowDefinitionStore, MongoDbWorkflowDefinitionStore>()
.AddScoped<IWorkflowInstanceStore, MongoDbWorkflowInstanceStore>()
elsa.Services
.AddScoped<MongoDbWorkflowDefinitionStore>()
.AddScoped<MongoDbWorkflowInstanceStore>()
.AddScoped<ElsaMongoDbClient>()
.AddScoped(sp => sp.GetRequiredService<ElsaMongoDbClient>().WorkflowDefinitions)
.AddScoped(sp => sp.GetRequiredService<ElsaMongoDbClient>().WorkflowInstances)
.AddWorkflowProvider<DatabaseWorkflowProvider>()
.AddStartupTask<DatabaseInitializer>();
elsa
.UseWorkflowDefinitionStore(sp => sp.GetRequiredService<MongoDbWorkflowDefinitionStore>())
.UseWorkflowInstanceStore(sp => sp.GetRequiredService<MongoDbWorkflowInstanceStore>());
DatabaseRegister.RegisterMapsAndSerializers();
}
}

View file

@ -28,6 +28,7 @@
<ItemGroup>
<PackageReference Include="YesSql.Core" Version="2.0.0-beta-1637" />
<PackageReference Include="YesSql.Provider.Sqlite" Version="1.0.0-beta-1637" />
</ItemGroup>
<ItemGroup>

View file

@ -1,39 +1,41 @@
using System;
using System.Data;
using System.Linq;
using Elsa.Data;
using Elsa.Data.Services;
using Elsa.Persistence.YesSql.Data;
using Elsa.Persistence.YesSql.Indexes;
using Elsa.Persistence.YesSql.Services;
using Elsa.Runtime;
using Elsa.WorkflowProviders;
using Microsoft.Extensions.DependencyInjection;
using YesSql;
using YesSql.Indexes;
using YesSql.Provider.Sqlite;
namespace Elsa.Persistence.YesSql
{
public static class IServiceCollectionExtensions
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddElsaPersistenceYesSql(this IServiceCollection services, Action<IServiceProvider, IConfiguration> configure)
public static ElsaOptions UseYesSqlPersistence(this ElsaOptions elsa) => elsa.UseYesSqlPersistence((_, config) => config.UseSqLite("Data Source=elsa.db;Cache=Shared", IsolationLevel.ReadUncommitted));
public static ElsaOptions UseYesSqlPersistence(this ElsaOptions elsa, Action<IServiceProvider, IConfiguration> configure)
{
// Scoped, because IMediator is registered as Scoped and IIdGenerator could also be registered as Scoped
services.AddScoped<IWorkflowDefinitionStore, YesSqlWorkflowDefinitionStore>()
.AddScoped<IWorkflowInstanceStore, YesSqlWorkflowInstanceStore>()
.AddWorkflowProvider<DatabaseWorkflowProvider>()
.AddSingleton(sp => CreateStore(sp, configure))
.AddScoped(CreateSession)
.AddScoped<IDataMigrationManager, DataMigrationManager>()
.AddStartupTask<DatabaseInitializer>()
.AddStartupTask<DataMigrationsRunner>()
.AddDataMigration<Migrations>()
.AddIndexProvider<WorkflowDefinitionIndexProvider>()
.AddIndexProvider<WorkflowInstanceIndexProvider>();
elsa.Services
.AddScoped<YesSqlWorkflowDefinitionStore>()
.AddScoped<YesSqlWorkflowInstanceStore>()
.AddSingleton(sp => CreateStore(sp, configure))
.AddScoped(CreateSession)
.AddScoped<IDataMigrationManager, DataMigrationManager>()
.AddStartupTask<DatabaseInitializer>()
.AddStartupTask<DataMigrationsRunner>()
.AddDataMigration<Migrations>()
.AddIndexProvider<WorkflowDefinitionIndexProvider>()
.AddIndexProvider<WorkflowInstanceIndexProvider>();
return services;
return elsa
.UseWorkflowDefinitionStore(sp => sp.GetRequiredService<YesSqlWorkflowDefinitionStore>())
.UseWorkflowInstanceStore(sp => sp.GetRequiredService<YesSqlWorkflowInstanceStore>());
}
public static IServiceCollection AddIndexProvider<T>(this IServiceCollection services) where T : class, IIndexProvider => services.AddSingleton<IIndexProvider, T>();
@ -68,4 +70,6 @@ namespace Elsa.Persistence.YesSql
return session;
}
}
}
}

View file

@ -14,8 +14,7 @@ namespace Elsa.Samples.ContextualWorkflowHttp
public void ConfigureServices(IServiceCollection services)
{
services
.AddElsa()
.AddElsaPersistenceYesSql((sp, config) => config.UseSqLite("Data Source=elsa.db;Cache=Shared", IsolationLevel.ReadUncommitted))
.AddElsa(options => options.UseYesSqlPersistence())
.AddHttpActivities()
.AddConsoleActivities()
.AddDataMigration<Migrations>()

View file

@ -7,7 +7,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.CorrelationHttp.Workflows;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@ -11,7 +10,6 @@ namespace Elsa.Samples.CorrelationHttp
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddHttpActivities()
.AddConsoleActivities()
.AddWorkflow<RegistrationWorkflow>();

View file

@ -7,7 +7,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,5 +1,3 @@
using Elsa.Persistence.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@ -11,7 +9,6 @@ namespace Elsa.Samples.CustomActivities
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddHttpActivities()
.AddActivity<ReadQueryString>()
.AddWorkflow<EchoQueryStringWorkflow>();

View file

@ -7,6 +7,5 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.ForkJoinTimerAndSignalHttp.BackgroundTasks;
using Elsa.Samples.ForkJoinTimerAndSignalHttp.Workflows;
using Microsoft.AspNetCore.Builder;
@ -15,7 +14,6 @@ namespace Elsa.Samples.ForkJoinTimerAndSignalHttp
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddHostedService<WorkflowStarter<DemoWorkflow>>()

View file

@ -7,7 +7,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,5 +1,3 @@
using Elsa.Persistence.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@ -11,7 +9,6 @@ namespace Elsa.Samples.HelloWorldHttp
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddHttpActivities()
.AddWorkflow<HelloHttpWorkflow>();
}

View file

@ -8,7 +8,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.Interrupts.Activities;
using Elsa.Samples.Interrupts.Workflows;
using Microsoft.AspNetCore.Builder;
@ -15,7 +14,6 @@ namespace Elsa.Samples.Interrupts
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddHttpActivities()
.AddTimerActivities()

View file

@ -6,8 +6,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.ReadModelHttp.Workflows;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@ -11,7 +10,6 @@ namespace Elsa.Samples.ReadModelHttp
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddHttpActivities()
.AddConsoleActivities()
.AddWorkflow<SaveContactWorkflow>();

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -18,7 +18,6 @@ namespace Elsa.Samples.DeclarativeCompositeActivitiesConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.BuildServiceProvider();

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
<ItemGroup>

View file

@ -22,7 +22,6 @@ namespace Elsa.Samples.FileBasedWorkflow
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa(options => options.UseStorage(() => StorageFactory.Blobs.DirectoryFiles(currentDirectory)))
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.BuildServiceProvider();

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -16,7 +16,6 @@ namespace Elsa.Samples.ForLoopConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddWorkflow<LoopingWorkflow>()
.BuildServiceProvider();

View file

@ -13,7 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -18,7 +18,6 @@ namespace Elsa.Samples.GoBackConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddActivity<BrickWallActivity>()
.AddWorkflow<WalkAroundWorkflow>()

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -13,7 +13,6 @@ namespace Elsa.Samples.HelloWorldConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddWorkflow<HelloWorld>()
.AddAutoMapperProfiles<Program>()

View file

@ -13,7 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -16,7 +16,6 @@ namespace Elsa.Samples.IfElseConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddWorkflow<HappinessWorkflow>()
.BuildServiceProvider();

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -15,7 +15,6 @@ namespace Elsa.Samples.ProgrammaticCompositeActivitiesConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddActivity<CountDownActivity>()
.AddWorkflow<CompositionWorkflow>()

View file

@ -7,12 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -14,7 +14,6 @@ namespace Elsa.Samples.ReadLineEchoConsole
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.BuildServiceProvider();
@ -23,14 +22,14 @@ namespace Elsa.Samples.ReadLineEchoConsole
await startupRunner.StartupAsync();
// Build a new workflow.
var workflow = services.GetService<IWorkflowBuilder>()
var workflow = services.GetRequiredService<IWorkflowBuilder>()
.WriteLine("What's your name?")
.ReadLine()
.WriteLine(context => $"Greetings, {context.Input}!")
.Build();
// Get a workflow runner.
var workflowRunner = services.GetService<IWorkflowRunner>();
var workflowRunner = services.GetRequiredService<IWorkflowRunner>();
// Execute the workflow.
await workflowRunner.RunWorkflowAsync(workflow);

View file

@ -7,12 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -17,14 +17,13 @@ namespace Elsa.Samples.Serialization
/// 3. Materialize a workflow definition model into a workflow blueprint.
/// 4. Run a workflow blueprint.
/// </summary>
class Program
internal class Program
{
static async Task Main(string[] args)
private static async Task Main()
{
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.BuildServiceProvider();
@ -50,7 +49,7 @@ namespace Elsa.Samples.Serialization
Type = nameof(WriteLine),
Properties = new ActivityDefinitionProperties
{
[nameof(WriteLine.Text)] = new ActivityDefinitionPropertyValue
[nameof(WriteLine.Text)] = new()
{
Syntax = LiquidExpressionHandler.SyntaxName,
Expression = "Hello World!",

View file

@ -7,12 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -10,14 +10,13 @@ namespace Elsa.Samples.SignalingConsole
/// <summary>
/// Demonstrates a workflow with a While looping construct.
/// </summary>
static class Program
internal static class Program
{
private static async Task Main()
{
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddWorkflow<TrafficLightWorkflow>()
.BuildServiceProvider();

View file

@ -7,12 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -9,14 +9,13 @@ namespace Elsa.Samples.WhileLoopConsole
/// <summary>
/// Demonstrates a workflow with a While looping construct.
/// </summary>
static class Program
internal static class Program
{
private static async Task Main()
{
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.BuildServiceProvider();

View file

@ -6,12 +6,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\activities\Elsa.Activities.AzureServiceBus\Elsa.Activities.AzureServiceBus.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\activities\Elsa.Activities.AzureServiceBus\Elsa.Activities.AzureServiceBus.csproj"/>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -20,7 +20,6 @@ namespace Elsa.Samples.AzureServiceBusWorker
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddAzureServiceBusActivities(options => options.ConnectionString = hostContext.Configuration.GetConnectionString("AzureServiceBus"))

View file

@ -7,12 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\activities\Elsa.Activities.Rebus\Elsa.Activities.Rebus.csproj" />
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
<ProjectReference Include="..\..\..\activities\Elsa.Activities.Rebus\Elsa.Activities.Rebus.csproj"/>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.CustomAttributesChildWorker.Messages;
using Elsa.Samples.CustomAttributesChildWorker.Workflows;
using Microsoft.Extensions.DependencyInjection;
@ -13,14 +12,13 @@ namespace Elsa.Samples.CustomAttributesChildWorker
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddTimerActivities()
.AddConsoleActivities()
.AddRebusActivities<OrderReceived>()

View file

@ -16,7 +16,6 @@
<ProjectReference Include="..\..\..\activities\Elsa.Activities.Timers\Elsa.Activities.Timers.csproj"/>
<ProjectReference Include="..\..\..\providers\Elsa.DistributedLocking.Redis\Elsa.DistributedLocking.Redis.csproj"/>
<ProjectReference Include="..\..\..\providers\Elsa.DistributedLocking.SqlServer\Elsa.DistributedLocking.SqlServer.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,5 +1,3 @@
using Elsa.Persistence.InMemory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;
@ -14,14 +12,13 @@ namespace Elsa.Samples.DistributedLock
{
private static async Task Main() => await CreateHostBuilder().UseConsoleLifetime().Build().RunAsync();
public static IHostBuilder CreateHostBuilder() =>
private static IHostBuilder CreateHostBuilder() =>
Host.CreateDefaultBuilder()
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa(options => options.UseRedisLockProvider("localhost:6379,abortConnect=false"))
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddWorkflow<RecurringWorkflow>();

View file

@ -12,6 +12,5 @@
<ItemGroup>
<ProjectReference Include="..\..\..\activities\Elsa.Activities.Rebus\Elsa.Activities.Rebus.csproj"/>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.MultiTenantChildWorker.Messages;
using Elsa.Samples.MultiTenantChildWorker.Workflows;
using Microsoft.Extensions.DependencyInjection;
@ -13,14 +12,13 @@ namespace Elsa.Samples.MultiTenantChildWorker
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddTimerActivities()
.AddConsoleActivities()
.AddRebusActivities<OrderReceived>()

View file

@ -15,6 +15,5 @@
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\servicebus\Elsa.Rebus.AzureServiceBus\Elsa.Rebus.AzureServiceBus.csproj"/>
<ProjectReference Include="..\..\..\servicebus\Elsa.Rebus.RabbitMq\Elsa.Rebus.RabbitMq.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.RebusWorker.Messages;
using Elsa.Samples.RebusWorker.Workflows;
using Microsoft.Extensions.DependencyInjection;
@ -8,18 +7,14 @@ namespace Elsa.Samples.RebusWorker
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
.ConfigureServices((_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddRebusActivities<Greeting>()

View file

@ -11,6 +11,5 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,3 @@
using Elsa.Persistence.InMemory;
using Elsa.Samples.RunChildWorkflowWorker.HostedServices;
using Elsa.Samples.RunChildWorkflowWorker.Workflows;
using Microsoft.Extensions.DependencyInjection;
@ -8,19 +7,15 @@ namespace Elsa.Samples.RunChildWorkflowWorker
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddHostedService<RunParentWorkflow>()
.AddWorkflow<ParentWorkflow>()

View file

@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -1,7 +1,4 @@
using System.Threading.Tasks;
using Elsa.Persistence.InMemory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NodaTime;
@ -12,14 +9,13 @@ namespace Elsa.Samples.Timers
{
private static async Task Main() => await CreateHostBuilder().UseConsoleLifetime().Build().RunAsync();
public static IHostBuilder CreateHostBuilder() =>
private static IHostBuilder CreateHostBuilder() =>
Host.CreateDefaultBuilder()
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddWorkflow<RecurringTaskWorkflow>()

View file

@ -11,6 +11,5 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Elsa\Elsa.csproj"/>
<ProjectReference Include="..\..\..\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -8,19 +8,15 @@ namespace Elsa.Samples.WhileLoopWorker
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(
(hostContext, services) =>
(_, services) =>
{
services
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities()
.AddTimerActivities()
.AddSingleton<PhoneCallService>()

View file

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="YesSql.Provider.Sqlite" Version="1.0.0-beta-1620" />
<PackageReference Include="YesSql.Provider.Sqlite" Version="1.0.0-beta-1637" />
</ItemGroup>
<ItemGroup>

View file

@ -26,11 +26,9 @@ namespace Elsa.Server.Host
public void ConfigureServices(IServiceCollection services)
{
var elsaSection = Configuration.GetSection("Elsa");
var connectionString = Configuration.GetConnectionString("Sqlite");
services
.AddElsa()
.AddElsaPersistenceYesSql((sp, config) => config.UseSqLite(connectionString, IsolationLevel.ReadUncommitted));
.AddElsa(options => options.UseYesSqlPersistence());
services
.AddElsaApiEndpoints()

View file

@ -7,9 +7,6 @@
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Sqlite": "Data Source=elsa.db;Cache=Shared"
},
"Elsa": {
"Http": {
"BaseUrl": "http://localhost:16398"
@ -18,9 +15,6 @@
"Host": "localhost",
"Port": "2525",
"DefaultSender": "noreply@acme.com"
},
"Timers": {
"SweepInterval": "00:00:30"
}
}
}

View file

@ -35,7 +35,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\src\core\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\src\persistence\Elsa.Persistence.InMemory\Elsa.Persistence.InMemory.csproj" />
</ItemGroup>
</Project>

View file

@ -22,7 +22,6 @@ namespace Elsa.Testing.Shared.Unit
var services = new ServiceCollection()
.AddElsa()
.AddElsaPersistenceInMemory()
.AddConsoleActivities(Console.In, new XunitConsoleForwarder(testOutputHelper));
configureServices?.Invoke(services);