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

Add "Transaction Id" and "Client Version" in Diagnostic Source traces #515

Merged
merged 5 commits into from
Apr 16, 2020

Conversation

cheenamalhotra
Copy link
Member

@cheenamalhotra cheenamalhotra commented Apr 7, 2020

Addressing request made by @davidmikh here: #93 (comment)

Hi @davidmikh

As per our offline discussions, I've made this PR to include "Transaction Id" to SqlCommand and SqlTransaction events and "Client Version" in SqlConnection events.

Regarding other 2 requests:

  • Include Connection Id in SqlTransaction events
    -- Connection.ClientConnectionId contains this info.
  • Include Server Version in SqlConnection open events
    -- Connection.ServerVersion contains this info.

Let me know if you need additional info from here.

P.S. Diagnostic Tests to be enabled in a separate PR (WIP @JRahnama PR #517)

Copy link
Contributor

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

This can be optimized to simply pass the SqlTransaction object to the diagnostic events. Then use transaction?.InternalTransaction?.TransactionId inside the anonymous type we create. This avoids the constant null checking in the calls to the diagnostic listener when there are no listeners enabled and looks cleaner, IMO.

@cheenamalhotra
Copy link
Member Author

Uploading NuGet Package for validation:
Microsoft.Data.SqlClient.2.0.0-dev-pr515.zip

Usage: <PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.0-dev-pr515" />

@davidmikh
Copy link

👍 Looks good to me, thanks for making these changes!

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.

5 participants