Files
Marc Gravell aecffecae1 attempt NRT makeover (#1928)
* attempt NRT makeover

- annotate NRTs on GridReader API
- add protected access to some of the GridReader internals
- switch GridReader callbacks to be more type-independent

docs

lib updates; deal with yellow warnings and test failures (SQL server certs and cancellation surfacing differently)

fix break

simplify proposed GridReader changes to protected OnBeforeGrid and OnAfterGrid[Async]

Builds: Bump library versions (#1935)

Tests: Upgrade dependencies for Dependabot (#1936)

I'll do a pass at all of these later, but getting CVE versions out of the pipe.

Resolving 4 alerts here: https://github.com/DapperLib/Dapper/security/dependabot

merge and lib updates

allow Identity to be constructed on-the-fly inside GridReader

fix build warnings

include readme

rev minor

- enable [SkipLocalsInit] everywhere
- use NET5_0_OR_GREATER
 for remoting check

# Conflicts:
#	Dapper/CommandDefinition.cs
#	Dapper/DefaultTypeMap.cs
#	Dapper/SqlMapper.Async.cs
#	Dapper/SqlMapper.IDataReader.cs
#	Dapper/SqlMapper.Link.cs
#	Dapper/SqlMapper.cs
#	Directory.Build.props

* shipped, not unshipped

* fixup SqlBuilder; use is null / is not null

* use central package management (#1949)

* Nullable test tweaks

* Nuget: let's just remove it!

* 2 test fixes from review

* fix FindExplicitConstructor

* add GetPropertySetterOrThrow

* fix NRT on FindConstructor

* DapperRow: value is object?

* use NotNullWhen

* make constructor problem more obvious

* test fixes

---------

Co-authored-by: Nick Craver <nrcraver@gmail.com>
2023-09-12 15:58:49 +01:00

61 lines
2.2 KiB
C#

using System;
using System.Data;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
#nullable enable
namespace Dapper.ProviderTools.Internal
{
internal sealed class DynamicBulkCopy : BulkCopy
{
internal static BulkCopy? Create(object? wrapped)
=> wrapped is null ? null : new DynamicBulkCopy(wrapped);
private DynamicBulkCopy(object wrapped)
=> _wrapped = wrapped;
private readonly dynamic _wrapped;
public override string DestinationTableName
{
get => _wrapped.DestinationTableName;
set => _wrapped.DestinationTableName = value;
}
public override object Wrapped => _wrapped;
public override void AddColumnMapping(string sourceColumn, string destinationColumn)
=> _wrapped.ColumnMappings.Add(sourceColumn, destinationColumn);
public override void AddColumnMapping(int sourceColumn, int destinationColumn)
=> _wrapped.ColumnMappings.Add(sourceColumn, destinationColumn);
public override void WriteToServer(DataTable source)
=> _wrapped.WriteToServer(source);
public override void WriteToServer(DataRow[] source)
=> _wrapped.WriteToServer(source);
public override void WriteToServer(IDataReader source)
=> _wrapped.WriteToServer(source);
public override Task WriteToServerAsync(DbDataReader source, CancellationToken cancellationToken)
=> _wrapped.WriteToServer(source, cancellationToken);
public override Task WriteToServerAsync(DataTable source, CancellationToken cancellationToken)
=> _wrapped.WriteToServer(source, cancellationToken);
public override Task WriteToServerAsync(DataRow[] source, CancellationToken cancellationToken)
=> _wrapped.WriteToServer(source, cancellationToken);
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (_wrapped is IDisposable d)
{
try { d.Dispose(); } catch { }
}
}
}
}
}