Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Async support #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Async support #8

wants to merge 4 commits into from

Conversation

SnakyBeaky
Copy link

Updated all projects to .NET Standard 2.0 / .NET Core 2.2
Added support for async command execution

@SnakyBeaky
Copy link
Author

@bcuff


namespace DataDog.Tracing.Sql
{
public class TraceDbCommand : IDbCommand
public class TraceDbCommand : DbCommand
Copy link
Owner

Choose a reason for hiding this comment

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

Using the base classes rather than the interfaces is going to break downstream consumers.

Copy link
Author

Choose a reason for hiding this comment

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

IDbCommand and IDbConnection are pre .NET 2.0 interfaces, when async/await wasn't still a thing, and therefore lack support for asynchronous methods.

DbCommand and DbConnection were introduced after async/await support, and to avoid breaking previous implementations by adding new functionality Microsoft decided to create those abstract base classes to extend further the interfaces with async methods.

All connectors (MySql connector, SQLServer connector, PostgreSQL Npgsql connector, etc...) implement the abstract classes and not the interfaces nowadays, so this change shouldn't break any consumer (other than those using old .NET versions, but those don't support either .NET Standard so it doesn't even matter because they wouldn't be able to consume this library anyways).

Copy link
Owner

Choose a reason for hiding this comment

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

It certainly breaks the one consumer I know about since they use the interfaces :)

Copy link
Owner

Choose a reason for hiding this comment

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

Do you intend to do the work of fixing this in WB?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I'll gladly work in the RepositoryBase implementation of the async overloads and all the Repositories that inherit from it!

It's probably a lot of work but I think it's worth the effort. Also we can leave the synchronous methods for backwards compatibility, maybe with the [ObsoleteAttribute].

Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
Copy link
Owner

Choose a reason for hiding this comment

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

Is this upgrade actually necessary? It's usually better to target as low a netstandard version as you can so that more people can use it.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, DbCommand and DbConnection classes are not implemented in 1.4.

Copy link
Owner

Choose a reason for hiding this comment

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

ok

@SnakyBeaky
Copy link
Author

SnakyBeaky commented Jun 3, 2019

Bumped version to 2.0.0. Is there something else missing, or is it ready to be published into the NuGet package repository?

@SnakyBeaky
Copy link
Author

@bcuff

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants