diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..8746ffbcc --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union \ No newline at end of file diff --git a/.gitignore b/.gitignore index 490152dc5..979e19bba 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,6 @@ packages/ #Ignore git-related files *.orig -.gitattributes #Rider .idea diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..7f97ba10b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# Contributing to Elsa Workflows +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + +## We develop with Github +We use github to host code, to track issues and feature requests, as well as to accept pull requests. + +## We use [Github Flow](https://guides.github.com/introduction/flow/index.html), So all code changes happen through pull requests +Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: + +1. Fork the repo and create your branch from `develop`. +1. Issue that pull request! + +## Any contributions you make will be under the New BSD License +In short, when you submit code changes, your submissions are understood to be under the same [New BSD License](https://github.com/elsa-workflows/elsa-core/blob/master/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](https://github.com/elsa-workflows/elsa-core/issues) +We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/elsa-workflows/elsa-core/issues/new); it's that easy! + +## Write bug reports with detail, background, and sample code +**Great Bug Reports** tend to have: + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. +- What you expected would happen +- What actually happens +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +People *love* thorough bug reports. I'm not even kidding. + +## Use a Consistent Coding Style +As a default, I am applying [Microsoft's Coding Conventions for .NET](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference). + +## License +By contributing, you agree that your contributions will be licensed under its [New BSD License](https://github.com/elsa-workflows/elsa-core/blob/master/LICENSE). + +## References +This document was adapted from the following [Gist](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62) diff --git a/Elsa.sln b/Elsa.sln index 963e9d058..26f084f34 100644 --- a/Elsa.sln +++ b/Elsa.sln @@ -65,6 +65,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.YesSql", "src\providers\Elsa.Persistence.YesSql\Elsa.Persistence.YesSql.csproj", "{235DA54C-336A-408F-903E-CD935012CEBC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E12F5CD9-0738-4F23-9438-26B65A0C53AA}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripting", "scripting", "{5E230C5F-7A64-4E95-A790-DF40CC66DA31}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Scripting.JavaScript", "src\scripting\Elsa.Scripting.JavaScript\Elsa.Scripting.JavaScript.csproj", "{DA91DAF2-4C59-4468-8F1D-6A500D218A1E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Core.UnitTests", "test\unit\Elsa.Core.UnitTests\Elsa.Core.UnitTests.csproj", "{715A6E74-05CD-4236-9287-1643B074117E}" EndProject @@ -120,10 +123,6 @@ Global {5A3C9D59-21FE-4BE3-A00A-FF3F198EEC97}.Debug|Any CPU.Build.0 = Debug|Any CPU {5A3C9D59-21FE-4BE3-A00A-FF3F198EEC97}.Release|Any CPU.ActiveCfg = Release|Any CPU {5A3C9D59-21FE-4BE3-A00A-FF3F198EEC97}.Release|Any CPU.Build.0 = Release|Any CPU - {72DA50EC-8A99-4D4F-BF61-DEF105BDAE10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72DA50EC-8A99-4D4F-BF61-DEF105BDAE10}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72DA50EC-8A99-4D4F-BF61-DEF105BDAE10}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72DA50EC-8A99-4D4F-BF61-DEF105BDAE10}.Release|Any CPU.Build.0 = Release|Any CPU {DA91DAF2-4C59-4468-8F1D-6A500D218A1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DA91DAF2-4C59-4468-8F1D-6A500D218A1E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA91DAF2-4C59-4468-8F1D-6A500D218A1E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -196,9 +195,7 @@ Global {C4939482-9447-47D1-B6AF-E9F8C6323841} = {B43B546E-23F3-46E8-ACB7-D04F05CDA180} {BC0F57E2-AB64-4026-B6E3-E03D9133DB26} = {B43B546E-23F3-46E8-ACB7-D04F05CDA180} {5A3C9D59-21FE-4BE3-A00A-FF3F198EEC97} = {B43B546E-23F3-46E8-ACB7-D04F05CDA180} - {9E1AF14C-0BEC-4BC2-810C-85FC25A9DDD4} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925} {5E230C5F-7A64-4E95-A790-DF40CC66DA31} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925} - {72DA50EC-8A99-4D4F-BF61-DEF105BDAE10} = {9E1AF14C-0BEC-4BC2-810C-85FC25A9DDD4} {DA91DAF2-4C59-4468-8F1D-6A500D218A1E} = {5E230C5F-7A64-4E95-A790-DF40CC66DA31} {9A2D1E3E-328F-4E02-86F8-84974925C1E3} = {5E230C5F-7A64-4E95-A790-DF40CC66DA31} {ED2A4FE5-821B-46F7-B72F-E66DE0D66C93} = {35F44BE9-13D0-417C-A01A-F0787BEE6DC3} diff --git a/LICENSE b/LICENSE index b92caa035..3f9e5379f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2019, Sipke Schoorstra +Copyright (c) 2020, .NET Foundation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 0e022432f..2e71fd62a 100644 --- a/README.md +++ b/README.md @@ -191,4 +191,13 @@ In order to build & run Elsa on your local machine, follow these steps: 2. Run NPM install on all folders containing packages.json (or run `node npm-install.js` - a script in the root that recursively installs the Node packages) 3. Execute gulp build from the directory src\dashboard\Elsa.Dashboard\Theme\argon-dashboard 4. Open a shell and navigate to `src/samples/Sample16` and run `dotnet run`. -5. Navigate to https://localhost:8632/elsa/home \ No newline at end of file +5. Navigate to https://localhost:8632/elsa/home + +# Code of Conduct + +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. +For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). + +### .NET Foundation + +This project is supported by the [.NET Foundation](https://dotnetfoundation.org). diff --git a/Samples.sln b/Samples.sln index 8236346ef..ca32c7e33 100644 --- a/Samples.sln +++ b/Samples.sln @@ -79,6 +79,7 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.MongoDb", "src\providers\Elsa.Persistence.MongoDb\Elsa.Persistence.MongoDb.csproj", "{36A6F881-1B40-438D-9B6D-80F01CE76D51}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.YesSql", "src\providers\Elsa.Persistence.YesSql\Elsa.Persistence.YesSql.csproj", "{DA825F41-EE97-47B3-801E-C694A6C53AEC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample18", "src\samples\Sample18\Sample18.csproj", "{616AA0BA-FBDD-4ABE-B688-A3F79F38C698}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Samples.Timers", "src\samples\Elsa.Samples.Timers\Elsa.Samples.Timers.csproj", "{071DD6EC-D00C-4513-82B6-3FE8438061E3}" EndProject @@ -154,6 +155,14 @@ Global {102626A4-8BA6-45A8-A69C-F5EB1F155BE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {102626A4-8BA6-45A8-A69C-F5EB1F155BE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {102626A4-8BA6-45A8-A69C-F5EB1F155BE7}.Release|Any CPU.Build.0 = Release|Any CPU + {616AA0BA-FBDD-4ABE-B688-A3F79F38C698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {616AA0BA-FBDD-4ABE-B688-A3F79F38C698}.Debug|Any CPU.Build.0 = Debug|Any CPU + {616AA0BA-FBDD-4ABE-B688-A3F79F38C698}.Release|Any CPU.ActiveCfg = Release|Any CPU + {616AA0BA-FBDD-4ABE-B688-A3F79F38C698}.Release|Any CPU.Build.0 = Release|Any CPU + {2AEA0028-96D6-4823-A88F-24294E4BA4E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2AEA0028-96D6-4823-A88F-24294E4BA4E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2AEA0028-96D6-4823-A88F-24294E4BA4E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2AEA0028-96D6-4823-A88F-24294E4BA4E8}.Release|Any CPU.Build.0 = Release|Any CPU {258F624E-98D7-4498-AE2E-F612D8ECA763}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {258F624E-98D7-4498-AE2E-F612D8ECA763}.Debug|Any CPU.Build.0 = Debug|Any CPU {258F624E-98D7-4498-AE2E-F612D8ECA763}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -246,6 +255,8 @@ Global {01DC21DD-C6E2-4B21-864E-97D29448F777} = {9C3C685E-3D7D-4638-A031-24F71CF74B52} {0D276728-DDA8-46A0-91A9-D44401D66DA9} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925} {102626A4-8BA6-45A8-A69C-F5EB1F155BE7} = {0D276728-DDA8-46A0-91A9-D44401D66DA9} + {616AA0BA-FBDD-4ABE-B688-A3F79F38C698} = {5E5E1E84-DDBC-40D6-B891-0D563A15A44A} + {2AEA0028-96D6-4823-A88F-24294E4BA4E8} = {5E5E1E84-DDBC-40D6-B891-0D563A15A44A} {258F624E-98D7-4498-AE2E-F612D8ECA763} = {B43B546E-23F3-46E8-ACB7-D04F05CDA180} {468E498C-59DB-4541-8D8A-0D89DE9083AB} = {DA71CDAA-8DD3-4D5F-9FBD-8E4B37A2D925} {D91E2F7B-D5B7-4D1C-A3F0-B0475C33F539} = {468E498C-59DB-4541-8D8A-0D89DE9083AB} diff --git a/src/core/Elsa.Abstractions/Extensions/WorkflowExtensions.cs b/src/core/Elsa.Abstractions/Extensions/WorkflowExtensions.cs index 6398b5ffd..832c749bc 100644 --- a/src/core/Elsa.Abstractions/Extensions/WorkflowExtensions.cs +++ b/src/core/Elsa.Abstractions/Extensions/WorkflowExtensions.cs @@ -60,23 +60,31 @@ namespace Elsa.Extensions /// public static IEnumerable GetInboundActivityPath(this Workflow workflow, string activityId) { - return workflow.GetInboundActivityPathInternal(activityId, activityId).Distinct().ToList(); + var inspectedActivityIDs = new HashSet(); + + return workflow.GetInboundActivityPathInternal(activityId, activityId, inspectedActivityIDs) + .Distinct().ToList(); } - private static IEnumerable GetInboundActivityPathInternal(this Workflow workflowInstance, string activityId, string startingPointActivityId) + private static IEnumerable GetInboundActivityPathInternal(this Workflow workflowInstance, + string activityId, + string startingPointActivityId, + HashSet inspectedActivityIDs) { foreach (var connection in workflowInstance.GetInboundConnections(activityId)) { // Circuit breaker: Detect workflows that implement repeating flows to prevent an infinite loop here. - if (connection.Source.Activity.Id == startingPointActivityId) + if (inspectedActivityIDs.Contains(connection.Source.Activity.Id)) yield break; yield return connection.Source.Activity.Id; - foreach (var parentActivityId in workflowInstance - .GetInboundActivityPathInternal(connection.Source.Activity.Id, startingPointActivityId) - .Distinct()) + foreach (var parentActivityId in workflowInstance.GetInboundActivityPathInternal(connection.Source.Activity.Id, startingPointActivityId, inspectedActivityIDs) + .Distinct()) + { + inspectedActivityIDs.Add(parentActivityId); yield return parentActivityId; + } } } } diff --git a/src/core/Elsa.Core/Elsa.Core.csproj b/src/core/Elsa.Core/Elsa.Core.csproj index f0a2d273d..6a69d90e8 100644 --- a/src/core/Elsa.Core/Elsa.Core.csproj +++ b/src/core/Elsa.Core/Elsa.Core.csproj @@ -49,7 +49,6 @@ - diff --git a/src/utils/Elsa.AutoMapper.Extensions/ServiceCollectionExtensions.cs b/src/core/Elsa.Core/Extensions/AutoMapperServiceCollectionExtensions.cs similarity index 87% rename from src/utils/Elsa.AutoMapper.Extensions/ServiceCollectionExtensions.cs rename to src/core/Elsa.Core/Extensions/AutoMapperServiceCollectionExtensions.cs index f3f04e257..7a440cb40 100644 --- a/src/utils/Elsa.AutoMapper.Extensions/ServiceCollectionExtensions.cs +++ b/src/core/Elsa.Core/Extensions/AutoMapperServiceCollectionExtensions.cs @@ -3,9 +3,9 @@ using AutoMapper; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -namespace Elsa.AutoMapper.Extensions +namespace Elsa.Extensions { - public static class ServiceCollectionExtensions + public static class AutoMapperServiceCollectionExtensions { public static IServiceCollection AddAutoMapper(this IServiceCollection services, ServiceLifetime lifetime) { @@ -18,7 +18,8 @@ namespace Elsa.AutoMapper.Extensions public static IServiceCollection AddAutoMapperProfile(this IServiceCollection services, ServiceLifetime lifetime) where TProfile : Profile { services.AddAutoMapper(lifetime); - return services.AddTransient(); + services.TryAddProvider(lifetime); + return services; } private static IConfigurationProvider CreateConfigurationProvider(IServiceProvider serviceProvider) diff --git a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs index 8fce03bda..ac65e04f2 100644 --- a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs +++ b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs @@ -8,6 +8,7 @@ using Elsa.AutoMapper.Extensions; using Elsa.Builders; using Elsa.Converters; using Elsa.Expressions; +using Elsa.Extensions; using Elsa.Mapping; using Elsa.Messaging; using Elsa.Messaging.Distributed; diff --git a/src/utils/Elsa.AutoMapper.Extensions/NodaTime/NodaTimeProfile.cs b/src/core/Elsa.Core/Mapping/NodaTimeProfile.cs similarity index 100% rename from src/utils/Elsa.AutoMapper.Extensions/NodaTime/NodaTimeProfile.cs rename to src/core/Elsa.Core/Mapping/NodaTimeProfile.cs diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/Entities/ActivityDefinitionEntity.cs b/src/providers/Elsa.Persistence.EntityFrameworkCore/Entities/ActivityDefinitionEntity.cs index 20907e6ea..d07813421 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/Entities/ActivityDefinitionEntity.cs +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/Entities/ActivityDefinitionEntity.cs @@ -8,6 +8,9 @@ namespace Elsa.Persistence.EntityFrameworkCore.Entities public string ActivityId { get; set; } public WorkflowDefinitionVersionEntity WorkflowDefinitionVersion { get; set; } public string Type { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + public string Description { get; set; } public int Left { get; set; } public int Top { get; set; } public Variables State { get; set; } diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/Mapping/EntitiesProfile.cs b/src/providers/Elsa.Persistence.EntityFrameworkCore/Mapping/EntitiesProfile.cs index f45e89b60..1bc29bd4f 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/Mapping/EntitiesProfile.cs +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/Mapping/EntitiesProfile.cs @@ -25,19 +25,28 @@ namespace Elsa.Persistence.EntityFrameworkCore.Mapping CreateMap() .ForMember(d => d.Id, d => d.Ignore()) - .ForMember(d => d.ActivityId, d => d.MapFrom(s => s.Id)); - + .ForMember(d => d.ActivityId, d => d.MapFrom(s => s.Id)) + .ForMember(d => d.WorkflowDefinitionVersion, d => d.Ignore()); + CreateMap() .ForCtorParam("id", p => p.MapFrom(s => s.ActivityId)) .ForMember(d => d.Id, d => d.MapFrom(s => s.ActivityId)); - + CreateMap() .ForMember(d => d.Id, d => d.Ignore()) - .ForMember(d => d.ActivityId, d => d.MapFrom(s => s.Id)); + .ForMember(d => d.ActivityId, d => d.MapFrom(s => s.Id)) + .ForMember(d => d.WorkflowInstance, d => d.Ignore()); CreateMap().ForMember(d => d.Id, d => d.MapFrom(s => s.ActivityId)); - CreateMap().ReverseMap(); - CreateMap().ReverseMap(); + CreateMap() + .ForMember(d => d.Id, d => d.Ignore()) + .ForMember(d => d.WorkflowInstance, d => d.Ignore()) + .ReverseMap(); + + CreateMap() + .ForMember(d => d.Id, d => d.Ignore()) + .ForMember(d => d.WorkflowDefinitionVersion, d => d.Ignore()) + .ReverseMap(); } } } \ No newline at end of file diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs index 682395de7..f758d288f 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.PostgreSql #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.0.1") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b => @@ -28,9 +28,18 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.PostgreSql b.Property("ActivityId") .HasColumnType("text"); + b.Property("Description") + .HasColumnType("text"); + + b.Property("DisplayName") + .HasColumnType("text"); + b.Property("Left") .HasColumnType("integer"); + b.Property("Name") + .HasColumnType("text"); + b.Property("State") .HasColumnType("text"); diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/SqlServer/SqlServerContextModelSnapshot.cs b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/SqlServer/SqlServerContextModelSnapshot.cs index 89b4f1042..f54ef71bc 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/SqlServer/SqlServerContextModelSnapshot.cs +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/SqlServer/SqlServerContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.SqlServer { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -30,9 +30,18 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.SqlServer b.Property("ActivityId") .HasColumnType("nvarchar(max)"); + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + b.Property("Left") .HasColumnType("int"); + b.Property("Name") + .HasColumnType("nvarchar(max)"); + b.Property("State") .HasColumnType("nvarchar(max)"); diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/Sqlite/SqliteContextModelSnapshot.cs b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/Sqlite/SqliteContextModelSnapshot.cs index 75ee11fa1..061b89465 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/Sqlite/SqliteContextModelSnapshot.cs +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/Migrations/Sqlite/SqliteContextModelSnapshot.cs @@ -1,8 +1,9 @@ -// +// using System; using Elsa.Persistence.EntityFrameworkCore.DbContexts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite { @@ -13,20 +14,30 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.1"); + .HasAnnotation("ProductVersion", "3.1.1"); modelBuilder.Entity("Elsa.Persistence.EntityFrameworkCore.Entities.ActivityDefinitionEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("INTEGER") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ActivityId") .HasColumnType("TEXT"); + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + b.Property("Left") .HasColumnType("INTEGER"); + b.Property("Name") + .HasColumnType("TEXT"); + b.Property("State") .HasColumnType("TEXT"); @@ -50,7 +61,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("INTEGER") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ActivityId") .HasColumnType("TEXT"); @@ -125,7 +137,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("INTEGER") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("DefinitionId") .HasColumnType("TEXT"); @@ -166,7 +179,8 @@ namespace Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("INTEGER") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("AbortedAt") .HasColumnType("TEXT"); diff --git a/src/providers/Elsa.Persistence.EntityFrameworkCore/README.md b/src/providers/Elsa.Persistence.EntityFrameworkCore/README.md index fc847ad13..90adaa2df 100644 --- a/src/providers/Elsa.Persistence.EntityFrameworkCore/README.md +++ b/src/providers/Elsa.Persistence.EntityFrameworkCore/README.md @@ -5,10 +5,10 @@ We should generate migration sets per provider as described here: https://docs.m 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 -dotnet ef migrations add InitialCreate --context PostgreSqlContext --output-dir Migrations/PostgreSql -dotnet ef migrations add InitialCreate --context MySqlContext --output-dir Migrations/MySql +dotnet ef migrations add Update01 --context SqliteContext --output-dir Migrations/Sqlite +dotnet ef migrations add Update01 --context SqlServerContext --output-dir Migrations/SqlServer +dotnet ef migrations add Update01 --context PostgreSqlContext --output-dir Migrations/PostgreSql +dotnet ef migrations add Update01 --context MySqlContext --output-dir Migrations/MySql ``` diff --git a/src/providers/Elsa.Persistence.YesSql/Extensions/YesSqlServiceCollectionExtensions.cs b/src/providers/Elsa.Persistence.YesSql/Extensions/YesSqlServiceCollectionExtensions.cs index c11bf8f26..32496bab1 100644 --- a/src/providers/Elsa.Persistence.YesSql/Extensions/YesSqlServiceCollectionExtensions.cs +++ b/src/providers/Elsa.Persistence.YesSql/Extensions/YesSqlServiceCollectionExtensions.cs @@ -1,6 +1,7 @@ using System; using Elsa.AutoMapper.Extensions; using Elsa.AutoMapper.Extensions.NodaTime; +using Elsa.Extensions; using Elsa.Persistence.YesSql.Indexes; using Elsa.Persistence.YesSql.Mapping; using Elsa.Persistence.YesSql.Schema; diff --git a/src/samples/README.md b/src/samples/README.md index d47e593ff..78e0838dd 100644 --- a/src/samples/README.md +++ b/src/samples/README.md @@ -2,27 +2,27 @@ This list of sample implementations showcase a variety of workflows using ELSA. -1. [Hello World: Strongly Typed](src/samples/WorkflowCore.Sample01) - A minimal workflows program defined in code with a strongly-typed workflow class. -2. [Hello World: Fluent Builder](src/samples/WorkflowCore.Sample02) - A minimal workflows program defined in code using fluent workflow builder and Console activities. -3. [Hello World: Workflow Definition](src/samples/WorkflowCore.Sample03) - A minimal workflows program defined as data (workflow definition) and Console activities. -4. [Calculator](src/samples/WorkflowCore.Sample04) - A strongly-typed, long-running workflows program demonstrating scripting, branching and resuming suspended workflows by providing user driven stimuli. -5. [Recurring](src/samples/WorkflowCore.Sample05) - A minimal workflows program defined in code with a strongly-typed workflow class. -6. [HttpRequest/HttpResponse](src/samples/WorkflowCore.Sample06) - Example of a workflow that intercepts a HttpRequest and handles the HttpResponse. -7. [Document Approval](src/samples/WorkflowCore.Sample07) - Example of a Document Approval workflow. -8. [Create and Handle Orders](src/samples/WorkflowCore.Sample08) - Example of a workflow that creates and handles orders. -9. [Calculator: Defined in Json](src/samples/WorkflowCore.Sample9) - A simple console program that loads & executes a workflow designed with the HTML5 workflow designer. -10. [Hellow World: YesSql](src/samples/WorkflowCore.Sample10) - A simple demonstration of using YesSql persistence providers. -11. [Correlation](src/samples/WorkflowCore.Sample11) - Demonstrates workflow correlation. -12. [User Task](src/samples/WorkflowCore.Sample12) - Demonstrates workflow correlation & user tasks. -13. [Activity Output](src/samples/WorkflowCore.Sample13) - A strongly-typed workflows program demonstrating scripting, and branching. -14. [Hellow World: Entity Framework Core](src/samples/WorkflowCore.Sample14) - A simple demonstration of using Entity Framework Core persistence providers. -15. [Hello World: MongoDb](src/samples/WorkflowCore.Sample15) - A simple demonstration of using the MongoDB persistence providers. Docker(optional) -16. [ELSA Dashboard: Web App, MongoDb Persistence](src/samples/WorkflowCore.Sample16) - ELSA Dashboard MVC wep application. -17. [Create Person: Console Application](src/samples/WorkflowCore.Sample17) - Example of a workflow that creates a Person entity. -18. [Email Reminder: Console Application](src/samples/WorkflowCore.Sample18) - Example of a workflow that sends email reminders on a timer until a condition is met. -19. [ELSA Dashboard: Web App, SqlLite Persistence](src/samples/WorkflowCore.Sample19) - Example of created a web application that hosts a ELSA Dashboard. -20. [Reflection Activities](src/samples/WorkflowCore.Sample20) - Demonstrates Reflection activities. -21. [Shopping Cart: Mass Transit & Quartz Scheduling](src/samples/WorkflowCore.Sample21) - Example of a workflow that tracks a shopping cart. Uses Mass Transit and Quartz scheduling. -22. [Hellow World: SQL Server](src/samples/WorkflowCore.Sample22) - A simple demonstration of using Entity Framework Core persistence providers with SQL Server. -23. [Hello World Custom Schema: Sqllite](src/samples/WorkflowCore.Sample23) - A simple demonstration of using Entity Framework Core persistence providers with SqlLite and Custom Schema. -24. [Hello World: MySql with migration](src/samples/WorkflowCore.Sample24) - A simple demonstration of using Entity Framework Core MySql persistence provider. A migration is also demonstrated. \ No newline at end of file +1. [Hello World: Strongly Typed](Sample01) - A minimal workflows program defined in code with a strongly-typed workflow class. +2. [Hello World: Fluent Builder](Sample02) - A minimal workflows program defined in code using fluent workflow builder and Console activities. +3. [Hello World: Workflow Definition](Sample03) - A minimal workflows program defined as data (workflow definition) and Console activities. +4. [Calculator](Sample04) - A strongly-typed, long-running workflows program demonstrating scripting, branching and resuming suspended workflows by providing user driven stimuli. +5. [Recurring](Sample05) - A minimal workflows program defined in code with a strongly-typed workflow class. +6. [HttpRequest/HttpResponse](Sample06) - Example of a workflow that intercepts a HttpRequest and handles the HttpResponse. +7. [Document Approval](Sample07) - Example of a Document Approval workflow. +8. [Create and Handle Orders](Sample08) - Example of a workflow that creates and handles orders. +9. [Calculator: Defined in Json](Sample9) - A simple console program that loads & executes a workflow designed with the HTML5 workflow designer. +10. [Hellow World: YesSql](Sample10) - A simple demonstration of using YesSql persistence providers. +11. [Correlation](Sample11) - Demonstrates workflow correlation. +12. [User Task](Sample12) - Demonstrates workflow correlation & user tasks. +13. [Activity Output](Sample13) - A strongly-typed workflows program demonstrating scripting, and branching. +14. [Hellow World: Entity Framework Core](Sample14) - A simple demonstration of using Entity Framework Core persistence providers. +15. [Hello World: MongoDb](Sample15) - A simple demonstration of using the MongoDB persistence providers. Docker(optional) +16. [ELSA Dashboard: Web App, MongoDb Persistence](Sample16) - ELSA Dashboard MVC wep application. +17. [Create Person: Console Application](Sample17) - Example of a workflow that creates a Person entity. +18. [Email Reminder: Console Application](Sample18) - Example of a workflow that sends email reminders on a timer until a condition is met. +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 and Quartz scheduling. +22. [Hellow 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. \ No newline at end of file diff --git a/src/scripting/Elsa.Scripting.JavaScript/Services/JavaScriptHandler.cs b/src/scripting/Elsa.Scripting.JavaScript/Services/JavaScriptHandler.cs index 36dc0f35a..00a730a88 100644 --- a/src/scripting/Elsa.Scripting.JavaScript/Services/JavaScriptHandler.cs +++ b/src/scripting/Elsa.Scripting.JavaScript/Services/JavaScriptHandler.cs @@ -71,13 +71,15 @@ namespace Elsa.Scripting.JavaScript.Services if (value.IsNull()) return default; - if (targetType == typeof(bool) && value.IsBoolean()) + var targetIsObject = targetType == typeof(object); + + if (value.IsBoolean()) return value.AsBoolean(); - if (targetType == typeof(DateTime) && value.IsDate()) + if ((targetIsObject || targetType == typeof(DateTime)) && value.IsDate()) return value.AsDate().ToDateTime(); - if ((targetType.IsNumeric() || targetType.IsObject()) && value.IsNumber()) + if (targetType.IsNumeric() && value.IsNumber()) { var numericType = targetType.IsNumeric() ? targetType : typeof(double); return Convert.ChangeType(value.AsNumber(), numericType); diff --git a/src/utils/Elsa.AutoMapper.Extensions/Elsa.AutoMapper.Extensions.csproj b/src/utils/Elsa.AutoMapper.Extensions/Elsa.AutoMapper.Extensions.csproj deleted file mode 100644 index df427b047..000000000 --- a/src/utils/Elsa.AutoMapper.Extensions/Elsa.AutoMapper.Extensions.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - netstandard2.0 - latest - 1.0.0 - Elsa Contributors - - Elsa is a set of workflow libraries and tools that enable super-fast workflowing capabilities in any .NET Core application. - This package provides extension methods that simplify registration of AutoMapper and profiles. - - 2019 - https://github.com/elsa-workflows/elsa-core - https://github.com/elsa-workflows/elsa-core - GitHub - elsa, workflows - icon.png - - - - - True - - - - - - - - - - - diff --git a/src/utils/Elsa.AutoMapper.Extensions/icon.png b/src/utils/Elsa.AutoMapper.Extensions/icon.png deleted file mode 100644 index f978a2882..000000000 Binary files a/src/utils/Elsa.AutoMapper.Extensions/icon.png and /dev/null differ