Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed usage of CreateIndexes for mongo #1287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

agentschmitt
Copy link

@agentschmitt agentschmitt commented Aug 14, 2024

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 #1250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant