From 853b7563ff8c19d75af5122cf1f6cd8343d2f383 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 1 Dec 2020 10:36:54 +0100 Subject: [PATCH] Update EF Core to .NET 5 --- docker-compose.yaml | 21 ++++++++++++++++++- .../Elsa.Dashboard.Web.csproj | 3 ++- src/dashboard/Elsa.Dashboard.Web/Startup.cs | 5 +++++ .../DbContexts/MySqlContextFactory.cs | 2 +- ...lsa.Persistence.EntityFrameworkCore.csproj | 20 +++++++++--------- src/samples/README.md | 2 +- src/samples/Sample14/Sample14.csproj | 6 +++--- src/samples/Sample19/Sample19.csproj | 2 +- src/samples/Sample22/Sample22.csproj | 6 +++--- src/samples/Sample23/Sample23.csproj | 8 +++---- src/samples/Sample24/Sample24.csproj | 6 +++--- 11 files changed, 53 insertions(+), 28 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 0f986837bb..77b76ecf47 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,9 +16,28 @@ services: image: mongo ports: - "27017:27017" + + postgresql: + image: postgres + environment: + - POSTGRES_HOST_AUTH_METHOD=trust + ports: + - 5432:5432 + + pgadmin: + image: dpage/pgadmin4 + environment: + - PGADMIN_DEFAULT_EMAIL=admin@local + - PGADMIN_DEFAULT_PASSWORD=Pass123! + - PGADMIN_LISTEN_PORT=5050 + ports: + - 5050:5050 smtp4dev: image: opvolger/rnwoodsmtp4dev ports: - "3000:80" - - "2525:25" \ No newline at end of file + - "2525:25" + +networks: + default: \ No newline at end of file diff --git a/src/dashboard/Elsa.Dashboard.Web/Elsa.Dashboard.Web.csproj b/src/dashboard/Elsa.Dashboard.Web/Elsa.Dashboard.Web.csproj index cb64d13750..f14140551f 100644 --- a/src/dashboard/Elsa.Dashboard.Web/Elsa.Dashboard.Web.csproj +++ b/src/dashboard/Elsa.Dashboard.Web/Elsa.Dashboard.Web.csproj @@ -1,12 +1,13 @@ - netcoreapp3.1 + net5.0 + diff --git a/src/dashboard/Elsa.Dashboard.Web/Startup.cs b/src/dashboard/Elsa.Dashboard.Web/Startup.cs index 7ec64dcbb7..e7534038d7 100644 --- a/src/dashboard/Elsa.Dashboard.Web/Startup.cs +++ b/src/dashboard/Elsa.Dashboard.Web/Startup.cs @@ -2,9 +2,12 @@ using Elsa.Activities.Http.Extensions; using Elsa.Activities.Timers.Extensions; using Elsa.Dashboard.Extensions; +using Elsa.Persistence.EntityFrameworkCore.DbContexts; +using Elsa.Persistence.EntityFrameworkCore.Extensions; using Elsa.Persistence.MongoDb.Extensions; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -27,6 +30,8 @@ public void ConfigureServices(IServiceCollection services) services // Add workflow services. .AddElsa(x => x.AddMongoDbStores(Configuration, "Elsa", "MongoDb")) + //.AddElsa(x => x.AddEntityFrameworkStores(db => db.UseSqlite("Data Source=elsa.db;Cache=Shared"))) + //.AddElsa(x => x.AddEntityFrameworkStores(db => db.UseNpgsql(@"Server=localhost;Database=Elsa;Port=5432;User Id=postgres;Password=Pass123!"))) // Add activities we'd like to use. // Configuring the activities as is done here is only required if we want to be able to actually run workflows form this application. diff --git a/src/persistence/Elsa.Persistence.EntityFrameworkCore/DbContexts/MySqlContextFactory.cs b/src/persistence/Elsa.Persistence.EntityFrameworkCore/DbContexts/MySqlContextFactory.cs index 9ccede4dd0..22af097f77 100644 --- a/src/persistence/Elsa.Persistence.EntityFrameworkCore/DbContexts/MySqlContextFactory.cs +++ b/src/persistence/Elsa.Persistence.EntityFrameworkCore/DbContexts/MySqlContextFactory.cs @@ -16,7 +16,7 @@ public MySqlContext CreateDbContext(string[] args) throw new InvalidOperationException("Set the EF_CONNECTIONSTRING environment variable to a valid MySQL connection string. E.g. SET EF_CONNECTIONSTRING=Server=localhost;Database=Elsa;User=sa;Password=Secret_password123!;"); optionsBuilder.UseMySql( - connectionString, + new MySqlServerVersion(ServerVersion.AutoDetect(connectionString)), x => x.MigrationsAssembly(migrationAssembly) ); diff --git a/src/persistence/Elsa.Persistence.EntityFrameworkCore/Elsa.Persistence.EntityFrameworkCore.csproj b/src/persistence/Elsa.Persistence.EntityFrameworkCore/Elsa.Persistence.EntityFrameworkCore.csproj index 602d71312f..04039de81c 100644 --- a/src/persistence/Elsa.Persistence.EntityFrameworkCore/Elsa.Persistence.EntityFrameworkCore.csproj +++ b/src/persistence/Elsa.Persistence.EntityFrameworkCore/Elsa.Persistence.EntityFrameworkCore.csproj @@ -1,8 +1,8 @@  - netstandard2.0 - netcoreapp3.1 + netstandard2.1 + net5.0 latest 1.0.0 Elsa Contributors @@ -27,20 +27,20 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/samples/README.md b/src/samples/README.md index 517cb928aa..0602de7f1f 100644 --- a/src/samples/README.md +++ b/src/samples/README.md @@ -23,7 +23,7 @@ This list of sample implementations showcase a variety of workflows using ELSA. 19. [ELSA Dashboard: Web App, SqlLite Persistence](Sample19) - Example of created a web application that hosts a ELSA Dashboard. 20. [Reflection Activities](Sample20) - Demonstrates Reflection activities. 21. [Shopping Cart: Mass Transit & Quartz Scheduling](Sample21) - Example of a workflow that tracks a shopping cart. Uses Mass Transit, RabbitMq and Quartz scheduling. -22. [Hellow World: SQL Server](Sample22) - A simple demonstration of using Entity Framework Core persistence providers with SQL Server. +22. [Hello World: SQL Server](Sample22) - A simple demonstration of using Entity Framework Core persistence providers with SQL Server. 23. [Hello World Custom Schema: Sqllite](Sample23) - A simple demonstration of using Entity Framework Core persistence providers with SqlLite and Custom Schema. 24. [Hello World: MySql with migration](Sample24) - A simple demonstration of using Entity Framework Core MySql persistence provider. A migration is also demonstrated. 25. [Data processing](Sample25) - A simple demonstration of flowing data through a pipeline of processing activities (https://github.com/elsa-workflows/elsa-core/issues/405). diff --git a/src/samples/Sample14/Sample14.csproj b/src/samples/Sample14/Sample14.csproj index 58865fb82a..8ffff68299 100644 --- a/src/samples/Sample14/Sample14.csproj +++ b/src/samples/Sample14/Sample14.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 latest @@ -12,11 +12,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/samples/Sample19/Sample19.csproj b/src/samples/Sample19/Sample19.csproj index 49471d2feb..cc315f6cd5 100644 --- a/src/samples/Sample19/Sample19.csproj +++ b/src/samples/Sample19/Sample19.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net5.0 diff --git a/src/samples/Sample22/Sample22.csproj b/src/samples/Sample22/Sample22.csproj index 58865fb82a..8ffff68299 100644 --- a/src/samples/Sample22/Sample22.csproj +++ b/src/samples/Sample22/Sample22.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 latest @@ -12,11 +12,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/samples/Sample23/Sample23.csproj b/src/samples/Sample23/Sample23.csproj index 51843b1ab2..71eff75aaa 100644 --- a/src/samples/Sample23/Sample23.csproj +++ b/src/samples/Sample23/Sample23.csproj @@ -2,16 +2,16 @@ Exe - netcoreapp3.1 + net5.0 - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/samples/Sample24/Sample24.csproj b/src/samples/Sample24/Sample24.csproj index 3471f4839e..0b131272ad 100644 --- a/src/samples/Sample24/Sample24.csproj +++ b/src/samples/Sample24/Sample24.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 latest @@ -12,11 +12,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - +