Skip to content

Commit b43f501

Browse files
committed
Renamed project
1 parent f963be5 commit b43f501

8 files changed

Lines changed: 128 additions & 108 deletions
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.28010.2036
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.Connection.Abstractions", "src\Dapper.Connection.Abstractions\Dapper.Connection.Abstractions.csproj", "{C8D54452-FE2D-4B5E-AED3-42C7E52ED5A3}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Testability.Adapters", "src\Dapper.Testability.Adapters\Dapper.Testability.Adapters.csproj", "{3D42F53D-69D5-442F-B010-E10D32B9E3A4}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{C8D54452-FE2D-4B5E-AED3-42C7E52ED5A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{C8D54452-FE2D-4B5E-AED3-42C7E52ED5A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{C8D54452-FE2D-4B5E-AED3-42C7E52ED5A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{C8D54452-FE2D-4B5E-AED3-42C7E52ED5A3}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{3D42F53D-69D5-442F-B010-E10D32B9E3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3D42F53D-69D5-442F-B010-E10D32B9E3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3D42F53D-69D5-442F-B010-E10D32B9E3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3D42F53D-69D5-442F-B010-E10D32B9E3A4}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {D45760AB-53A0-44EA-BEE8-38477E3D43F2}
23+
SolutionGuid = {842FD5E7-02A1-4773-9D68-ADE522A87EEA}
2424
EndGlobalSection
2525
EndGlobal
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Collections.Generic;
2+
using System.Data;
3+
using System.Threading.Tasks;
4+
using Dapper.Contrib.Extensions;
5+
6+
namespace Dapper.Testability.Adapters
7+
{
8+
//This partial class is reserved for the Dapper.Contrib implementation
9+
public partial class ConnectionAdapter
10+
{
11+
public Task<T> GetAsync<T>(dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
12+
SqlMapperExtensions.GetAsync<T>(_connection, id, transaction, commandTimeout);
13+
14+
public Task<IEnumerable<T>> GetAllAsync<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
15+
_connection.GetAllAsync<T>(transaction, commandTimeout);
16+
17+
public Task<int> InsertAsync<T>(T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null, ISqlAdapter sqlAdapter = null) where T : class =>
18+
_connection.InsertAsync(entityToInsert, transaction, commandTimeout, sqlAdapter);
19+
20+
public Task<bool> UpdateAsync<T>(T entityToUpdate, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
21+
_connection.UpdateAsync(entityToUpdate, transaction, commandTimeout);
22+
23+
public Task<bool> DeleteAsync<T>(T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
24+
_connection.DeleteAsync(entityToDelete, transaction, commandTimeout);
25+
26+
public Task<bool> DeleteAllAsync<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
27+
_connection.DeleteAllAsync<T>(transaction, commandTimeout);
28+
29+
public T Get<T>(dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
30+
SqlMapperExtensions.Get<T>(_connection, id, transaction, commandTimeout);
31+
32+
public IEnumerable<T> GetAll<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
33+
_connection.GetAll<T>(transaction, commandTimeout);
34+
35+
public long Insert<T>(T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
36+
_connection.Insert(entityToInsert, transaction, commandTimeout);
37+
38+
public bool Update<T>(T entityToUpdate, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
39+
_connection.Update(entityToUpdate, transaction, commandTimeout);
40+
41+
public bool Delete<T>(T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
42+
_connection.Delete(entityToDelete, transaction, commandTimeout);
43+
44+
public bool DeleteAll<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
45+
_connection.DeleteAll<T>(transaction, commandTimeout);
46+
}
47+
}

src/Dapper.Connection.Abstractions/DapperConnection.cs renamed to src/Dapper.Testability.Adapters/ConnectionAdapter.Dapper.cs

Lines changed: 4 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,14 @@
1-
using Dapper.Contrib.Extensions;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.Data;
54
using System.Data.SqlClient;
65
using System.Threading.Tasks;
76

8-
namespace Dapper.Connection.Abstractions
7+
namespace Dapper.Testability.Adapters
98
{
10-
public class DapperConnection : IDapperConnection
9+
//This partial class is reserved for the Dapper implementation
10+
public partial class ConnectionAdapter
1111
{
12-
private readonly IDbConnection _connection;
13-
14-
public DapperConnection(IDbConnection connection)
15-
{
16-
_connection = connection ?? throw new ArgumentNullException(nameof(connection));
17-
}
18-
19-
public string ConnectionString
20-
{
21-
get => _connection.ConnectionString;
22-
set => _connection.ConnectionString = value;
23-
}
24-
25-
public int ConnectionTimeout => _connection.ConnectionTimeout;
26-
27-
public string Database => _connection.Database;
28-
29-
public ConnectionState State => _connection.State;
30-
31-
public IDbTransaction BeginTransaction()
32-
{
33-
return _connection.BeginTransaction();
34-
}
35-
36-
public IDbTransaction BeginTransaction(IsolationLevel il)
37-
{
38-
return _connection.BeginTransaction(il);
39-
}
40-
41-
public void Close()
42-
{
43-
_connection.Close();
44-
}
45-
46-
public void ChangeDatabase(string databaseName)
47-
{
48-
_connection.ChangeDatabase(databaseName);
49-
}
50-
51-
public IDbCommand CreateCommand()
52-
{
53-
return _connection.CreateCommand();
54-
}
55-
56-
public void Open()
57-
{
58-
_connection.Open();
59-
}
60-
61-
6212
public IEnumerable<T> Query<T>(string sql, object param = null, SqlTransaction transaction = null, bool buffered = true) =>
6313
_connection.Query<T>(sql, param, transaction, buffered);
6414

@@ -344,51 +294,5 @@ public IEnumerable<TReturn> Query<TFirst, TSecond, TThird, TFourth, TFifth, TSix
344294
public IEnumerable<TReturn> Query<TReturn>(string sql, Type[] types, Func<object[], TReturn> map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) =>
345295
_connection.Query(sql, types, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
346296

347-
public Task<T> GetAsync<T>(dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
348-
SqlMapperExtensions.GetAsync<T>(_connection, id, transaction, commandTimeout);
349-
350-
public Task<IEnumerable<T>> GetAllAsync<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
351-
_connection.GetAllAsync<T>(transaction, commandTimeout);
352-
353-
public Task<int> InsertAsync<T>(T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null, ISqlAdapter sqlAdapter = null) where T : class =>
354-
_connection.InsertAsync(entityToInsert, transaction, commandTimeout, sqlAdapter);
355-
356-
public Task<bool> UpdateAsync<T>(T entityToUpdate, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
357-
_connection.UpdateAsync(entityToUpdate, transaction, commandTimeout);
358-
359-
public Task<bool> DeleteAsync<T>(T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
360-
_connection.DeleteAsync(entityToDelete, transaction, commandTimeout);
361-
362-
public Task<bool> DeleteAllAsync<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
363-
_connection.DeleteAllAsync<T>(transaction, commandTimeout);
364-
365-
public T Get<T>(dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
366-
SqlMapperExtensions.Get<T>(_connection, id, transaction, commandTimeout);
367-
368-
public IEnumerable<T> GetAll<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
369-
_connection.GetAll<T>(transaction, commandTimeout);
370-
371-
public long Insert<T>(T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
372-
_connection.Insert(entityToInsert, transaction, commandTimeout);
373-
374-
public bool Update<T>(T entityToUpdate, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
375-
_connection.Update(entityToUpdate, transaction, commandTimeout);
376-
377-
public bool Delete<T>(T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
378-
_connection.Delete(entityToDelete, transaction, commandTimeout);
379-
380-
public bool DeleteAll<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class =>
381-
_connection.DeleteAll<T>(transaction, commandTimeout);
382-
383-
384-
385-
public void Dispose()
386-
{
387-
_connection.Dispose();
388-
}
389-
390-
391297
}
392-
393-
394298
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Data;
2+
3+
namespace Dapper.Testability.Adapters
4+
{
5+
//This partial class is reserved for the IDbConnection implementation
6+
public partial class ConnectionAdapter
7+
{
8+
public string ConnectionString
9+
{
10+
get => _connection.ConnectionString;
11+
set => _connection.ConnectionString = value;
12+
}
13+
14+
public int ConnectionTimeout => _connection.ConnectionTimeout;
15+
16+
public string Database => _connection.Database;
17+
18+
public ConnectionState State => _connection.State;
19+
20+
public IDbTransaction BeginTransaction() => _connection.BeginTransaction();
21+
22+
public IDbTransaction BeginTransaction(IsolationLevel il) => _connection.BeginTransaction(il);
23+
24+
public void Close() => _connection.Close();
25+
26+
public void ChangeDatabase(string databaseName) => _connection.ChangeDatabase(databaseName);
27+
28+
public IDbCommand CreateCommand() => _connection.CreateCommand();
29+
30+
public void Open() => _connection.Open();
31+
}
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Data;
3+
4+
namespace Dapper.Testability.Adapters
5+
{
6+
public partial class ConnectionAdapter : IConnectionAdapter
7+
{
8+
private readonly IDbConnection _connection;
9+
10+
public ConnectionAdapter(IDbConnection connection)
11+
{
12+
_connection = connection ?? throw new ArgumentNullException(nameof(connection));
13+
}
14+
15+
public IDbConnection GetUnderlyingConnection() => _connection;
16+
17+
public void Dispose() => _connection.Dispose();
18+
}
19+
}

src/Dapper.Connection.Abstractions/Dapper.Connection.Abstractions.csproj renamed to src/Dapper.Testability.Adapters/Dapper.Testability.Adapters.csproj

File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28010.2036
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Global
7+
GlobalSection(SolutionProperties) = preSolution
8+
HideSolutionNode = FALSE
9+
EndGlobalSection
10+
GlobalSection(ExtensibilityGlobals) = postSolution
11+
SolutionGuid = {842FD5E7-02A1-4773-9D68-ADE522A87EEA}
12+
EndGlobalSection
13+
EndGlobal

src/Dapper.Connection.Abstractions/IDapperConnection.cs renamed to src/Dapper.Testability.Adapters/IConnectionAdapter.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
using System.Data.SqlClient;
55
using System.Threading.Tasks;
66

7-
namespace Dapper.Connection.Abstractions
7+
namespace Dapper.Testability.Adapters
88
{
9-
public interface IDapperConnection : IDbConnection
9+
public interface IConnectionAdapter : IDbConnection
1010
{
11+
IDbConnection GetUnderlyingConnection();
12+
13+
//Dapper Methods
1114
IEnumerable<T> Query<T>(string sql, object param = null, SqlTransaction transaction = null, bool buffered = true);
1215
IEnumerable<dynamic> Query(string sql, object param = null, SqlTransaction transaction = null, bool buffered = true);
1316
int Execute(string sql, object param = null, SqlTransaction transaction = null);
@@ -103,6 +106,8 @@ public interface IDapperConnection : IDbConnection
103106
IEnumerable<TReturn> Query<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>(string sql, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn> map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null);
104107
IEnumerable<TReturn> Query<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(string sql, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn> map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null);
105108
IEnumerable<TReturn> Query<TReturn>(string sql, Type[] types, Func<object[], TReturn> map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null);
109+
110+
//Dapper.Contrib methods
106111
Task<T> GetAsync<T>(dynamic id, IDbTransaction transaction = null, int? commandTimeout = null) where T : class;
107112
Task<IEnumerable<T>> GetAllAsync<T>(IDbTransaction transaction = null, int? commandTimeout = null) where T : class;
108113
Task<int> InsertAsync<T>(T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null, ISqlAdapter sqlAdapter = null) where T : class;

0 commit comments

Comments
 (0)