Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Commit

Permalink
big rename to DapperWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
half-ogre committed Jun 30, 2012
1 parent 4127fc6 commit 907f26f
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -2,6 +2,6 @@ bin
obj
*.user
*.suo
DbExecutor*.nupkg
DapperWrapper*.nupkg
_ReSharper*
packages
2 changes: 1 addition & 1 deletion Build-Package.ps1
@@ -1,4 +1,4 @@
$scriptPath = Split-Path $MyInvocation.MyCommand.Path
$projFile = Join-Path $scriptPath DbExecutor.msbuild
$projFile = Join-Path $scriptPath DapperWrapper.msbuild

& "$(get-content env:windir)\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" $projFile /p:Configuration=Release /t:Package
2 changes: 1 addition & 1 deletion Build-Solution.ps1
@@ -1,4 +1,4 @@
$scriptPath = Split-Path $MyInvocation.MyCommand.Path
$projFile = Join-Path $scriptPath DbExecutor.msbuild
$projFile = Join-Path $scriptPath DapperWrapper.msbuild

& "$(get-content env:windir)\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" $projFile /p:Configuration=Release /t:Build
6 changes: 3 additions & 3 deletions DbExecutor.msbuild → DapperWrapper.msbuild
Expand Up @@ -10,15 +10,15 @@
</PropertyGroup>

<Target Name="Clean">
<MSBuild Projects=".\DbExecutor.sln" Targets="Clean" Properties="Configuration=$(Configuration)"/>
<MSBuild Projects=".\DapperWrapper.sln" Targets="Clean" Properties="Configuration=$(Configuration)"/>
</Target>

<Target Name="Build" DependsOnTargets="Clean">
<MSBuild Projects=".\DbExecutor.sln" Targets="Build" Properties="Configuration=$(Configuration)"/>
<MSBuild Projects=".\DapperWrapper.sln" Targets="Build" Properties="Configuration=$(Configuration)"/>
</Target>

<Target Name="Package" DependsOnTargets="Build;CheckPrerequisites">
<Exec WorkingDirectory=".\DbExecutor" Command="$(PackCommand)"/>
<Exec WorkingDirectory=".\DapperWrapper" Command="$(PackCommand)"/>
</Target>

</Project>
11 changes: 8 additions & 3 deletions DbExecutor.sln → DapperWrapper.sln
Expand Up @@ -3,11 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B3ADF38-DC0C-4F69-854C-5333D9B1D4EB}"
ProjectSection(SolutionItems) = preProject
Scripts\Create-NuGetPackage.ps1 = Scripts\Create-NuGetPackage.ps1
Scripts\DbExecutor.msbuild = Scripts\DbExecutor.msbuild
Build-Package.ps1 = Build-Package.ps1
Build-Solution.ps1 = Build-Solution.ps1
DapperWrapper.msbuild = DapperWrapper.msbuild
LICENSE.txt = LICENSE.txt
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.targets = .nuget\NuGet.targets
README.markdown = README.markdown
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbExecutor", "DbExecutor\DbExecutor.csproj", "{0E94BB6B-8213-4B74-B362-A84D42B1AE5D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DapperWrapper", "DapperWrapper\DapperWrapper.csproj", "{0E94BB6B-8213-4B74-B362-A84D42B1AE5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Expand Up @@ -8,8 +8,8 @@
<ProjectGuid>{0E94BB6B-8213-4B74-B362-A84D42B1AE5D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DbExecutor</RootNamespace>
<AssemblyName>DbExecutor</AssemblyName>
<RootNamespace>DapperWrapper</RootNamespace>
<AssemblyName>DapperWrapper</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
Expand Down Expand Up @@ -55,7 +55,7 @@
<Compile Include="TransactionScopeWrapper.cs" />
</ItemGroup>
<ItemGroup>
<None Include="DbExecutor.nuspec">
<None Include="DapperWrapper.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
Expand Down
Expand Up @@ -5,11 +5,11 @@
<version>$version$</version>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://github.com/half-ogre/DbExecutor/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/half-ogre/DbExecutor</projectUrl>
<licenseUrl>https://github.com/half-ogre/dapper-wrapper/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/half-ogre/dapper-wrapper</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<tags>anglicangeek the-half-ogre dapper data</tags>
<tags>anglicangeek anglican geek halfogre half-ogre half ogre dapper wrapper dapperwrapper</tags>
<dependencies>
<dependency id="Dapper" version="1.8" />
</dependencies>
Expand Down
32 changes: 32 additions & 0 deletions DapperWrapper/IDbExecutor.cs
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Data;

namespace DapperWrapper
{
public interface IDbExecutor : IDisposable
{
int Execute(
string sql,
object param = null,
IDbTransaction transaction = null,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?));

IEnumerable<dynamic> Query(
string sql,
object param = null,
IDbTransaction transaction = null,
bool buffered = true,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?));

IEnumerable<T> Query<T>(
string sql,
object param = null,
IDbTransaction transaction = null,
bool buffered = true,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?));
}
}
@@ -1,9 +1,8 @@

namespace DbExecutor
namespace DapperWrapper
{
public interface IDbExecutorFactory
{
IDbExecutor CreateExecutor();
ITransactionScope CreateTransactionScope();
}
}
@@ -1,6 +1,6 @@
using System;

namespace DbExecutor
namespace DapperWrapper
{
public interface ITransactionScope : IDisposable
{
Expand Down
Expand Up @@ -2,9 +2,9 @@
using System.Runtime.InteropServices;

[assembly: AssemblyCompany("Andrew Miller")]
[assembly: AssemblyProduct("AnglicanGeek.DbExecutor")]
[assembly: AssemblyCopyright("Copyright (C) Andrew Miller")]
[assembly: AssemblyTitle("AnglicanGeek.DbExecutor")]
[assembly: AssemblyProduct("DapperWrapper")]
[assembly: AssemblyCopyright("Copyright (c) 2011-2012 Andrew Miller")]
[assembly: AssemblyTitle("DapperWrapper")]
[assembly: AssemblyDescription("A simple abstraction atop the Dapper extension methods for testability.")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyVersion("0.3.0.0")]
71 changes: 71 additions & 0 deletions DapperWrapper/SqlExecutor.cs
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Dapper;

namespace DapperWrapper
{
public class SqlExecutor : IDbExecutor
{
readonly SqlConnection _sqlConnection;

public SqlExecutor(SqlConnection sqlConnection)
{
_sqlConnection = sqlConnection;
}

public int Execute(
string sql,
object param = null,
IDbTransaction transaction = null,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?))
{
return _sqlConnection.Execute(
sql,
param,
transaction,
commandTimeout,
commandType);
}

public IEnumerable<dynamic> Query(
string sql,
object param = null,
IDbTransaction transaction = null,
bool buffered = true,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?))
{
return _sqlConnection.Query(
sql,
param,
transaction,
buffered,
commandTimeout,
commandType);
}

public IEnumerable<T> Query<T>(
string sql,
object param = null,
IDbTransaction transaction = null,
bool buffered = true,
int? commandTimeout = default(int?),
CommandType? commandType = default(CommandType?))
{
return _sqlConnection.Query<T>(
sql,
param,
transaction,
buffered,
commandTimeout,
commandType);
}

public void Dispose()
{
_sqlConnection.Dispose();
}
}
}
@@ -1,34 +1,24 @@
using System;
using System.Data.SqlClient;
using System.Transactions;

namespace DbExecutor
namespace DapperWrapper
{
public class SqlExecutorFactory : IDbExecutorFactory
{
readonly string connectionString;
readonly string _connectionString;

public SqlExecutorFactory(string connectionString)
{
if (string.IsNullOrWhiteSpace(connectionString))
throw new ArgumentNullException("connectionString");

this.connectionString = connectionString;
_connectionString = connectionString;
}

public IDbExecutor CreateExecutor()
{
var dbConnection = new SqlConnection(connectionString);

var dbConnection = new SqlConnection(_connectionString);
dbConnection.Open();

return new SqlExecutor(dbConnection);
}


public ITransactionScope CreateTransactionScope()
{
return new TransactionScopeWrapper(new TransactionScope());
}
}
}
@@ -1,24 +1,24 @@
using System.Transactions;

namespace DbExecutor
namespace DapperWrapper
{
public class TransactionScopeWrapper : ITransactionScope
{
readonly TransactionScope transactionScope;
readonly TransactionScope _transactionScope;

public TransactionScopeWrapper(TransactionScope transactionScope)
{
this.transactionScope = transactionScope;
_transactionScope = transactionScope;
}

public void Complete()
{
transactionScope.Complete();
_transactionScope.Complete();
}

public void Dispose()
{
transactionScope.Dispose();
_transactionScope.Dispose();
}
}
}
}
File renamed without changes.
12 changes: 0 additions & 12 deletions DbExecutor/IDbExecutor.cs

This file was deleted.

31 changes: 0 additions & 31 deletions DbExecutor/SqlExecutor.cs

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,4 +1,4 @@
Copyright (c) 2011 Andrew Miller <ego@anglicangeek.com>
Copyright (c) 2011-2012 Andrew Miller <nemo@half-ogre.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down

0 comments on commit 907f26f

Please sign in to comment.