-
Couldn't load subscription status.
- Fork 316
Closed
Labels
Public API 🆕Issues/PRs that introduce new APIs to the driver.Issues/PRs that introduce new APIs to the driver.
Description
Relates to #1825
Testing local build (main) with Dapper shows a few problems, i.e. "it doesn't work"; severity: IMO critical, this should absolutely be fixed before next build; the batch API is not usable by non-provider scenarios without it
SqlConnectionfails tooverridetheCanCreateBatchandCreateDbBatch()members (net6+)SqlBatchCommanddoesoverridetheCanCreateParameterandCreateParameter()members (net8+), but: the library does not currently build for net8, so: this code is never actually compiled as far as I can see
Suggestions:
for SqlConnection:
#if NET6_0_OR_GREATER
/// <inheritdoc/>
public override bool CanCreateBatch => true;
/// <inheritdoc/>
protected override SqlBatch CreateDbBatch() => new SqlBatch(this);
#endif(you may have local rules on docs, especially since we're doing type variance here)
in the csproj:
- add
net8.0to<TargetFrameworks>
tests:
for net6+
using var cnn = new SqlConnection();
Assert.True(cnn.CanCreateBatch);
var batch = cnn.CreateBatch();
Assert.Is<SqlBatch>(batch);
Assert.Same(cnn, batch.Connection);
Assert.Null(batch.Transaction);for net8+
var cmd = new SqlBatchCommand();
Assert.True(cnn.CanCreateParameter);
Assert.Is<SqlParameter>(cnn.CreateParameter());roji
Metadata
Metadata
Assignees
Labels
Public API 🆕Issues/PRs that introduce new APIs to the driver.Issues/PRs that introduce new APIs to the driver.
Type
Projects
Status
Closed