Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
ed90d66e
Commit
ed90d66e
authored
Aug 30, 2019
by
mgravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing APIs to BulkCopy
parent
b6639146
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
BulkCopy.cs
Dapper.ProviderTools/BulkCopy.cs
+24
-2
DynamicBulkCopy.cs
Dapper.ProviderTools/Internal/DynamicBulkCopy.cs
+4
-0
No files found.
Dapper.ProviderTools/BulkCopy.cs
View file @
ed90d66e
...
@@ -30,6 +30,20 @@ public abstract class BulkCopy : IDisposable
...
@@ -30,6 +30,20 @@ public abstract class BulkCopy : IDisposable
return
DynamicBulkCopy
.
Create
(
obj
);
return
DynamicBulkCopy
.
Create
(
obj
);
}
}
/// <summary>
/// Create a BulkCopy instance for the connection provided
/// </summary>
public
static
BulkCopy
Create
(
DbConnection
connection
)
{
var
bcp
=
TryCreate
(
connection
);
if
(
bcp
==
null
)
{
if
(
connection
==
null
)
throw
new
ArgumentNullException
(
nameof
(
connection
));
throw
new
NotSupportedException
(
"Unable to create BulkCopy for "
+
connection
.
GetType
().
FullName
);
}
return
bcp
;
}
/// <summary>
/// <summary>
/// Provide an external registration for a given connection type
/// Provide an external registration for a given connection type
/// </summary>
/// </summary>
...
@@ -74,15 +88,23 @@ public static void Register(Type type, Func<DbConnection, object>? factory)
...
@@ -74,15 +88,23 @@ public static void Register(Type type, Func<DbConnection, object>? factory)
/// <summary>
/// <summary>
/// Write a set of data to the server
/// Write a set of data to the server
/// </summary>
/// </summary>
public
abstract
void
WriteToServer
(
DataRow
[]
source
);
/// <summary>
/// Write a set of data to the server
/// </summary>
public
abstract
void
WriteToServer
(
IDataReader
source
);
public
abstract
void
WriteToServer
(
IDataReader
source
);
/// <summary>
/// <summary>
/// Write a set of data to the server
/// Write a set of data to the server
/// </summary>
/// </summary>
public
abstract
Task
WriteToServerAsync
(
DbDataReader
source
,
CancellationToken
cancellationToken
);
public
abstract
Task
WriteToServerAsync
(
DbDataReader
source
,
CancellationToken
cancellationToken
=
default
);
/// <summary>
/// Write a set of data to the server
/// </summary>
public
abstract
Task
WriteToServerAsync
(
DataTable
source
,
CancellationToken
cancellationToken
=
default
);
/// <summary>
/// <summary>
/// Write a set of data to the server
/// Write a set of data to the server
/// </summary>
/// </summary>
public
abstract
Task
WriteToServerAsync
(
Data
Table
source
,
CancellationToken
cancellationToken
);
public
abstract
Task
WriteToServerAsync
(
Data
Row
[]
source
,
CancellationToken
cancellationToken
=
default
);
/// <summary>
/// <summary>
/// Add a mapping between two columns by name
/// Add a mapping between two columns by name
/// </summary>
/// </summary>
...
...
Dapper.ProviderTools/Internal/DynamicBulkCopy.cs
View file @
ed90d66e
...
@@ -32,6 +32,8 @@ public override void AddColumnMapping(int sourceColumn, int destinationColumn)
...
@@ -32,6 +32,8 @@ public override void AddColumnMapping(int sourceColumn, int destinationColumn)
public
override
void
WriteToServer
(
DataTable
source
)
public
override
void
WriteToServer
(
DataTable
source
)
=>
_wrapped
.
WriteToServer
(
source
);
=>
_wrapped
.
WriteToServer
(
source
);
public
override
void
WriteToServer
(
DataRow
[]
source
)
=>
_wrapped
.
WriteToServer
(
source
);
public
override
void
WriteToServer
(
IDataReader
source
)
public
override
void
WriteToServer
(
IDataReader
source
)
=>
_wrapped
.
WriteToServer
(
source
);
=>
_wrapped
.
WriteToServer
(
source
);
...
@@ -41,6 +43,8 @@ public override Task WriteToServerAsync(DbDataReader source, CancellationToken c
...
@@ -41,6 +43,8 @@ public override Task WriteToServerAsync(DbDataReader source, CancellationToken c
public
override
Task
WriteToServerAsync
(
DataTable
source
,
CancellationToken
cancellationToken
)
public
override
Task
WriteToServerAsync
(
DataTable
source
,
CancellationToken
cancellationToken
)
=>
_wrapped
.
WriteToServer
(
source
,
cancellationToken
);
=>
_wrapped
.
WriteToServer
(
source
,
cancellationToken
);
public
override
Task
WriteToServerAsync
(
DataRow
[]
source
,
CancellationToken
cancellationToken
)
=>
_wrapped
.
WriteToServer
(
source
,
cancellationToken
);
protected
override
void
Dispose
(
bool
disposing
)
protected
override
void
Dispose
(
bool
disposing
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment