Conversation
…ion-method shortcuts with the null-conditional operator, so you can drop the explicit if (loggerInstance is not null) blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code review and suggested changes
This pull request introduces several improvements and refactorings to the
SharpFunctional.MSSQLcodebase, focusing on enhanced dependency injection, improved time abstraction for testing, better exception handling, and more explicit transaction management. The changes also clarify and enforce constructor parameters, update logging extension methods, and ensure consistent naming across the API.Dependency Injection and API Consistency
dbConnectioninstead ofconnection, improving clarity and aligning with usage in bothFunctionalMsSqlDband dependency injection extension methods. [1] [2] [3] [4] [5] [6]FunctionalMsSqlDbclass to enforce that either aDbContextor adbConnectionmust be provided, throwing an exception otherwise, and added a runtime check inInTransactionAsync. [1] [2]AmbientTransactionto use the newGetAmbientTransaction()method for better encapsulation. [1] [2] [3] [4] [5] [6]Circuit Breaker Improvements
CircuitBreakerto accept an optionalTimeProvider, replacing direct calls toDateTime.UtcNowwithTimeProvider.Systemby default. This makes the circuit breaker more testable and flexible. [1] [2] [3] [4] [5]Exception Handling and Functional Extensions
OperationCanceledExceptionis rethrown, while other exceptions are caught and result in an emptyOptionorSeq, with a TODO comment suggesting future logging or richer error handling. [1] [2] [3]Logging API Modernization
FunctionalMsSqlDbLogto usethis ILogger loggerfor improved extension method syntax and consistency with .NET logging best practices.Minor Fixes and Cleanups
dbContextin place of the oldEfContextproperty.These changes collectively improve the maintainability, testability, and clarity of the codebase.