Skip to content

Refactor connection string handling for flexibility #712

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

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

bpfz
Copy link
Contributor

@bpfz bpfz commented Mar 12, 2025

Replaced direct usage of connection strings with a function that retrieves the connection string.

This change allows for runtime generation or modification of the connection string. Updates were made across multiple files, including BaseSqlRepository.cs, SessionRepository.cs, StorageRepository.cs, SqlServerPersistentStorage.cs, SqlServerPersistentStorageSettings.cs, SqlServerStorageExtensions.cs, and SqlStorageTests.cs.

The connection string is now accessed via a ConnectionStringFunc delegate, and corresponding tests have been updated to reflect this new structure.

Replaced direct usage of connection strings with a function that retrieves the connection string. This change allows for runtime generation or modification of the connection string. Updates were made across multiple files, including `BaseSqlRepository.cs`, `SessionRepository.cs`, `StorageRepository.cs`, `SqlServerPersistentStorage.cs`, `SqlServerPersistentStorageSettings.cs`, `SqlServerStorageExtensions.cs`, and `SqlStorageTests.cs`. The connection string is now accessed via a `ConnectionStringFunc` delegate, and corresponding tests have been updated to reflect this new structure.
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 10e6977 Previous: 22d4209 Ratio
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.InnerJoin 405484905.5555556 ns (± 7225634.860015955) 458826533.3333333 ns (± 10640413.19005047) 0.88
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.LeftJoin 483645072.2222222 ns (± 29506729.027620878) 564994640 ns (± 28550338.329818636) 0.86
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.ProjectionAndNormalization 149457300 ns (± 21283094.506569188) 169842820 ns (± 7144067.768715523) 0.88
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.SumAggregation 168910850 ns (± 11171747.746087996) 171581250 ns (± 12415362.812660772) 0.98
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.ListAggWithMapAggregation 1832900220 ns (± 98416435.89018159) 1982296640 ns (± 123349811.75190067) 0.92

This comment was automatically generated by workflow using github-action-benchmark.

@Ulimo Ulimo requested a review from Copilot March 12, 2025 12:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the connection string handling to improve flexibility by replacing direct usage with a delegate-based approach.

  • Updated multiple files to call ConnectionStringFunc() instead of using a hardcoded ConnectionString.
  • Added an overload in SqlServerStorageExtensions to accept a connection string function, and updated tests accordingly.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SqlServerStorageExtensions.cs Added overload to accept Func and updated connection string usage
BaseSqlRepository.cs Replaced direct connection string usage with connection string function calls
SqlServerPersistentStorageSettings.cs Changed connection string property type from string to Func
SqlServerPersistentStorage.cs Updated connection string usage to use the delegate function
SessionRepository.cs Updated connection string usage to call ConnectionStringFunc()
SqlStorageTests.cs Updated settings to return connection string via Func
StorageRepository.cs Replaced ConnectionString with ConnectionStringFunc() in SQL connection creation

@Ulimo
Copy link
Contributor

Ulimo commented Mar 12, 2025

Looks great, would be super if the docs could be updated as well

@bpfz
Copy link
Contributor Author

bpfz commented Mar 12, 2025

Looks great, would be super if the docs could be updated as well

fixed

Updated docs with an example of the new functionality.

Copy link
Contributor

@Ulimo Ulimo left a comment

Choose a reason for hiding this comment

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

LGTM

@bpfz bpfz merged commit 96bf5f4 into main Mar 12, 2025
7 checks passed
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.

2 participants