This solves an issue where the Dashboard site would not be able to run in IIS, due to an IIS filter that expects a IISServer instance, while it was being decorated with a custom type.
Fortunately, as of .NET Core 3, background hosted services now execute before the server starts, which makes them perfect for async initialization.
* Fixed Yaml serialisation/deserialisation
Copied json serializer settings from JsonTokenFormatter, apart from CamelCasePropertyNamesContractResolver, as the yaml already had the correct case, and this would cause activity state (which has PascalCasing) to be camelCased too
* Updated YamlDotNet.Standard to YamlDotNet
Switched package as YamlDotNet.Standard has been unlisted on Nuget
* Added MySqlContext
* Added MySqlContextFactory
* Added Pomelo.EntityFrameworkCore.MySql nuget package
* Added initial MySqlContext migrations
* Added support for creating derived ElsaContexts:
- Added new protected constructor based on following post
- https://github.com/dotnet/efcore/issues/7533
* Added Sample 24 - MySql provider with migration execution
* Updated other samples that needed to define the derived ElsaContext
* Added summary to ElsaContext constructor
* Updated persistence/Elsa.Persistence.EntityFrameworkCore MD file with MySql example
Added extensible support for specialized primitive handling such as
DateTime and NodaTime primitives.
This fixes the issue where a Variable is serialized using a primitive's
string representation and losing the target type, which is needed for
reconstructing the type upon deserialization.
* Explicitly specify identity for Id columns
This fixes an issue where EF Core 2.2 does not set Identity = Yes when
defining the Id columns.
* Fix DateTime serialization issue
This change fixes an issue by taking over the serialization of a DateTime value.
The problem with serializing a DateTime value as-is is that upon deserialization, the JToken type would be set as String instead of Date.
This is because NodaTime disables automatic date time handling for Instant types.
However that causes an issue when trying to serialize and deserialize DateTime values.
This change explicitly tests for DateTime values and handles it appropriately.
A future improvement might be to make this TypeNameHandlingConverter class extensible by implementing a provider-based model,
enabling developers to take control over how certain types are serialized.
* Added PostgreSql support to Elsa.Persistence.EntityFrameworkCore via Npgsql.
* Customize Elsa.Persistence.EntityFrameworkCore Migrations and Schema.
* Added Context factory in Sample23 to use the IDbContextCustomSchema.
* Refactor the Custom Schema support to use the EFCore IDbContextOptionsExtension.
* GetVariable<T> now uses Convert.ChangeType
Fixes issue where saving an Int32, serialising and deserialising, then accessing with GetVariable<int>(...) no longer causes type cast exception.
The saved value is a JValue which treats Int32 as Int64. Convert.ChangeType has a better chance of performing conversion without error.
Also returns default of T if the variable isn't found.
* Added SetVariable overload in Variables
To prevent double-wrapping objects in more than 1 Variable object
* WorkflowInstanceIndex now stores records correctly
* Saving a workflow instance now updates existing instance rather than creating a new document
* Fixed serialisation exception when saving existing instance containing NodaTime types