-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug SqlBulkCopy DataReader ordinal - dotnet/corefx#24655
- Loading branch information
julien
committed
Mar 10, 2018
1 parent
b4d310c
commit 79458d4
Showing
10 changed files
with
106 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace QueryBuilder.Core.Database | ||
{ | ||
public interface ITransactionScope<TTransaction> : IDisposable | ||
{ | ||
TTransaction Current { get; } | ||
|
||
void Commit(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/QueryBuilder.EFCore/Database/DbContextTransactionScope.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Data.Common; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using QueryBuilder.Core.Database; | ||
|
||
namespace QueryBuilder.EFCore.Database | ||
{ | ||
public class DbContextTransactionScope<TTransaction> | ||
: ITransactionScope<TTransaction> | ||
where TTransaction : DbTransaction | ||
{ | ||
private readonly IDbContextTransaction _dbContextTransaction; | ||
public TTransaction Current => (TTransaction)_dbContextTransaction.GetDbTransaction(); | ||
|
||
public DbContextTransactionScope(IDbContextTransaction dbContextTransaction) | ||
{ | ||
_dbContextTransaction = dbContextTransaction ?? throw new ArgumentNullException(nameof(dbContextTransaction)); | ||
} | ||
|
||
public void Commit() | ||
{ | ||
_dbContextTransaction.Commit(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_dbContextTransaction?.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/QueryBuilder.EntityFramework/Database/DbTransactionTransactionScope.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.Common; | ||
using System.Data.Entity.Core.EntityClient; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using QueryBuilder.Core.Database; | ||
|
||
namespace QueryBuilder.EntityFramework.Database | ||
{ | ||
public class DbTransactionTransactionScope<TTransaction> | ||
: ITransactionScope<TTransaction> | ||
where TTransaction : DbTransaction | ||
{ | ||
private readonly DbTransaction _dbTransaction; | ||
public TTransaction Current => (TTransaction)((EntityTransaction)_dbTransaction).StoreTransaction; | ||
|
||
public DbTransactionTransactionScope(DbTransaction dbTransaction) | ||
{ | ||
_dbTransaction = dbTransaction ?? throw new ArgumentNullException(nameof(dbTransaction)); | ||
} | ||
|
||
public void Commit() | ||
{ | ||
_dbTransaction.Commit(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_dbTransaction?.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
src/QueryBuilder.SqlServer/Bulk/DataReader/IBulkDataReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
|
||
namespace QueryBuilder.SqlServer.Bulk.DataReader | ||
{ | ||
public interface IBulkDataReader : IDataReader | ||
{ | ||
IReadOnlyCollection<string> Columns { get; } | ||
/// <summary> | ||
/// The ordinal and name of the columns | ||
/// </summary> | ||
IReadOnlyCollection<Tuple<int, string>> Columns { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters