Describe the change
Fixed usage of CreateIndexes for MongoPersistenceProvider.cs to avoid database connection already opening during ioc.
Doing database operations in constructor of services that are registered in ioc is dangerous.
In case of connection error the application will crash during ioc already.
Describe the change Fixed usage of CreateIndexes for MongoPersistenceProvider.cs to avoid database connection already opening during ioc. Doing database operations in constructor of services that are registered in ioc is dangerous. In case of connection error the application will crash during ioc already.
Describe your implementation or design I checked how EntityFrameworkPersistenceProvider does database changes and its done in EnsureStoreExists there. https://github.com/danielgerlag/workflow-core/blob/master/src/providers/WorkflowCore.Persistence.EntityFramework/Services/EntityFrameworkPersistenceProvider.cs#L192
Tests I adjusted the MongoPersistenceProviderFixture to call EnsureStoreExists like its done for the other Providers too.
Breaking change Change should be minor, as EnsureStoreExists is already used from workflow-core for other providers.
Additional context Some of the mongo unit tests do not execute, but this was already the case before my change. This is probably cause of the mongodb driver update from 2.8 to 2.19 https://www.mongodb.com/docs/drivers/csharp/v2.19/faq/#what-object-types-can-be-serialized- There is already in issue for this https://github.com/danielgerlag/workflow-core/issues/1250