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

Adds DataOptionsSetup #456

Merged
merged 21 commits into from
Sep 9, 2024
Merged

Adds DataOptionsSetup #456

merged 21 commits into from
Sep 9, 2024

Conversation

Astasian
Copy link
Contributor

@Astasian Astasian commented Sep 5, 2024

Fixes #18

Changes

Adds a DataOptionsSetup class to be able to configure custom DataOptions for linq2db

Remarks

  • I didn’t want to add whole new PersistenceSetup class, so it’s just a Setup for the DataOptions. Otherwise, there would be three ways to configure the plugin, and more testing would be necessary.

  • If the data options are provided, the user must add the provider and the connection string again (if needed). Linq2Db checks for different configuration variations, and always adding the connection string and the provider name would exclude some configurations (like a connection factory).
    See here

  • In this first version I didn’t include a Multi Setup class, like AzureTableStorageMultiJournalSetup. Would this be a blocker to a PR?

  • I didn’t include a test for this setup, because the configs are patched in the corresponding Journal/Snapshot classes. So I really don’t know where or how to put it. Do you have an advise on this?

  • The Copy Methods and private constructors like here could be replaced by records with with copying. But I didn't want to make any potential breaking changes.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Astasian and others added 21 commits September 3, 2024 00:18
* Add MultiDataOptionsSetup support
* Add/improve default HOCON settings
* Move DataOptions usage in Hosting extension to its own extension method
* Move DataOptions properties to SqlJournalOptions and SqlSnapshotOptions
* Make sure that all config files have correct equality method
* Make sure that all config files returns a proper hash code
* Make sure that AkkaPersistenceDataConnectionFactory uses the proper DataOptions
  * Use DataOptions.GetHashCode if config.DataOptions is not null
  * Always use DataOptions RetryPolicy if it is defined
  * Remove RetryPolicy property from AkkaDataConnection (dead code)
* Make sure that SqlWriteJournal, SqlReadJournal and SqlSnapshotStore applies the correct DataOptionsSetup
  * Use DataOptions from DataOptionsSetup if it is defined
  * Use/override DataOptions from MultiDataOptionsSetup if it exist for the current plugin id
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - went through this over a call with @Arkatufus

@Aaronontheweb Aaronontheweb merged commit 5eb18b9 into akkadotnet:dev Sep 9, 2024
3 checks passed
@Astasian Astasian deleted the add-sql-setup branch September 9, 2024 21:47
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.

Create Setup Classes to allow configuration without writing real HOCON
3 participants