mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 14:27:47 +08:00
ae7a29a9f1
Due to the way VS test works (by injecting an executable entry point), the performance tests needed to be factored out. I also organized all of our existing tests better along the way. Actual code changes to Dapper itself are very minor, only formatting and documentation fixes (which we need many more of). The build.ps1 script is upated to work, but note that <frameworkAssemblies> is not working in .nuspec inside the packages in the new .csproj system. I consider this to be a blocker. Issue is here: https://github.com/NuGet/Home/issues/4853
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Dapper.Tests
|
|
{
|
|
public class TransactedConnection : IDbConnection
|
|
{
|
|
private readonly IDbConnection _conn;
|
|
private readonly IDbTransaction _tran;
|
|
|
|
public TransactedConnection(IDbConnection conn, IDbTransaction tran)
|
|
{
|
|
_conn = conn;
|
|
_tran = tran;
|
|
}
|
|
|
|
public string ConnectionString
|
|
{
|
|
get { return _conn.ConnectionString; }
|
|
set { _conn.ConnectionString = value; }
|
|
}
|
|
|
|
public int ConnectionTimeout => _conn.ConnectionTimeout;
|
|
public string Database => _conn.Database;
|
|
public ConnectionState State => _conn.State;
|
|
|
|
public IDbTransaction BeginTransaction(IsolationLevel il)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public IDbTransaction BeginTransaction() => _tran;
|
|
|
|
public void ChangeDatabase(string databaseName) => _conn.ChangeDatabase(databaseName);
|
|
|
|
public void Close() => _conn.Close();
|
|
|
|
public IDbCommand CreateCommand()
|
|
{
|
|
// The command inherits the "current" transaction.
|
|
var command = _conn.CreateCommand();
|
|
command.Transaction = _tran;
|
|
return command;
|
|
}
|
|
|
|
public void Dispose() => _conn.Dispose();
|
|
|
|
public void Open() => _conn.Open();
|
|
}
|
|
}
|