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

Prevent logging data from being affected by transactions. #392

Merged
merged 7 commits into from
Mar 7, 2022

Conversation

ckadluba
Copy link
Member

@ckadluba ckadluba commented Feb 27, 2022

The sink now adds ";Enlist=False" to the connection string which avoids that logging SQL commands take part in ambient transactions (e.g. by TransactionScopes in the caller's program).

This is done by default but it can be turned off by setting the new sink option EnlistInTransaction to true.

Additionally all tests are now also executed for .NET Framework 4.7.2. With that the test run for all target frameworks of the sink.

Original input and implementation came from @Daniel-Svensson in pr #379 but had to be changed a bit and therefore commited with this pr.

* Added class SqlConnectionStringBuilderWrapper to add Enlist= parameter. Used in in SqlConnectionFactory.
* Added new sink option PreventEnlistInTransaction in code and documented it in README.
* Tests
README.md Outdated Show resolved Hide resolved
* Renamed PreventEnlistInTransactions to EnlistInTransaction and changed default to false.
* Fixed typos in README.
…run from all other tests to avoid side effects with other DB tests. Ugly but the only feasible way to get this stable.
@ckadluba ckadluba requested a review from jonorossi March 4, 2022 18:00
jonorossi
jonorossi previously approved these changes Mar 6, 2022
* Increased connection timeout when deleting or creating DB in DB tests (enables stable parallel execution of all DB tests including the transaction test).
* Let all tests execute in one run again. No more separation of transaction DB test necessary.
@ckadluba ckadluba force-pushed the feature/enlist-false-enhanced branch from cf92489 to 11cb6a3 Compare March 7, 2022 07:56
@ckadluba ckadluba merged commit 6fa5cc8 into serilog-mssql:dev Mar 7, 2022
@ckadluba ckadluba deleted the feature/enlist-false-enhanced branch March 7, 2022 08:19
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