Commit 7d7d11b7 authored by Marc Gravell's avatar Marc Gravell

Merge branch 'master' of github.com:StackExchange/dapper-dot-net

parents ad5afe13 bfa4e57d
/*.suo
.vs/
bin/
obj/
/*.user
......
......@@ -32,5 +32,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -1026,6 +1026,15 @@ public bool Equals(Identity other)
}
}
/// <summary>
/// Obtains the data as a list; if it is *already* a list, the original object is returned without
/// any duplication; otherwise, ToList() is invoked.
/// </summary>
public static List<T> AsList<T>(this IEnumerable<T> source)
{
return (source == null || source is List<T>) ? (List<T>)source : source.ToList();
}
#if CSHARP30
/// <summary>
/// Execute parameterized SQL
......@@ -2584,9 +2593,11 @@ private static Exception MultiMapException(IDataRecord reader)
if (startBound == 0)
{
r.GetValues(values);
for (int i = 0; i < values.Length; i++)
if (values[i] is DBNull) values[i] = null;
{
object val = r.GetValue(i);
values[i] = val is DBNull ? null : val;
}
}
else
{
......@@ -4457,6 +4468,9 @@ partial class ParamInfo
internal Action<object, DynamicParameters> OutputCallback { get; set; }
internal object OutputTarget { get; set; }
internal bool CameFromTemplate { get; set; }
public byte? Precision { get; set; }
public byte? Scale { get; set; }
}
/// <summary>
......@@ -4529,20 +4543,30 @@ public void AddDynamicParams(object param)
/// <summary>
/// Add a parameter to this dynamic parameter list
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
/// <param name="dbType"></param>
/// <param name="direction"></param>
/// <param name="size"></param>
public void Add(string name, object value, DbType? dbType, ParameterDirection? direction, int? size)
{
parameters[Clean(name)] = new ParamInfo() {
Name = name, Value = value, ParameterDirection = direction ?? ParameterDirection.Input,
DbType = dbType, Size = size
};
}
/// <summary>
/// Add a parameter to this dynamic parameter list
/// </summary>
public void Add(
#if CSHARP30
string name, object value, DbType? dbType, ParameterDirection? direction, int? size
string name, object value, DbType? dbType, ParameterDirection? direction, int? size, byte? precision, byte? scale
#else
string name, object value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null
string name, object value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null, byte? precision = null, byte? scale = null
#endif
)
{
parameters[Clean(name)] = new ParamInfo() { Name = name, Value = value, ParameterDirection = direction ?? ParameterDirection.Input, DbType = dbType, Size = size };
parameters[Clean(name)] = new ParamInfo() {
Name = name, Value = value, ParameterDirection = direction ?? ParameterDirection.Input,
DbType = dbType, Size = size,
Precision = precision, Scale = scale
};
}
static string Clean(string name)
......@@ -4686,7 +4710,9 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
if (param.Size != null)
{
p.Size = param.Size.Value;
}
}
if (param.Precision != null) p.Precision = param.Precision.Value;
if (param.Scale != null) p.Scale = param.Scale.Value;
}
else
{
......
using System;
#if ASYNC
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
......@@ -829,3 +830,4 @@ private async static Task<T> ExecuteScalarImplAsync<T>(IDbConnection cnn, Comman
}
}
}
#endif
\ No newline at end of file
......@@ -18,6 +18,7 @@ static void Main(string[] args)
RunTests();
Setup();
RunAsyncTests();
Console.WriteLine("Press any key...");
Console.ReadKey();
}
......
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Dapper.Contrib</id>
<version>1.1</version>
<version>1.40</version>
<authors>Sam Saffron,Johan Danforth</authors>
<owners>Sam Saffron,Johan Danforth</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
......@@ -10,8 +10,11 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A collection of create,insert,update,delete helpers for dapper.net</description>
<tags>orm sql micro-orm</tags>
<releaseNotes>
* 1.40 - cumulative changes up to dapper 1.40; will track changes more carefully subsequently
</releaseNotes>
<dependencies>
<dependency id="Dapper" version="1.27" />
<dependency id="Dapper" version="1.40" />
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
......
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>b6eae030-3119-49c0-adb5-39e25ba60c4c</ProjectGuid>
<RootNamespace>Dapper.DNX.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AssemblyName>Dapper.DNX.Tests</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
\ No newline at end of file
using System;
using System.Linq;
using System.Data.SqlClient;
using System.Threading.Tasks;
namespace Dapper.DNX.Tests
{
public class Program
{
public void Main()
{
Console.WriteLine("Version: {0}", Environment.Version);
const string connectionString = "Data Source=.;Initial Catalog=tempdb;Integrated Security=True";
using (var conn = new SqlConnection(connectionString))
{
conn.Open();
var row = conn.Query<Foo>("select @a as X", new { a = 123 }).Single();
Console.WriteLine(row.X);
var methods = typeof(Dapper.SqlMapper).GetMethods().Where(x => x.Name == "QueryAsync").ToList();
row = conn.QueryAsync<Foo>("select @a as X", new { a = 123 }).Result.Single();
Console.WriteLine(row.X);
}
}
private static async Task<int> WithDelay(int i)
{
await Task.Delay(100);
return i;
}
class Foo
{
public int X { get; set; }
}
}
}
{
"profiles": {}
}
\ No newline at end of file
{
"version": "1.0.0-*",
"dependencies": {
"Dapper": "1.40-*"
},
"commands": {
"Dapper.DNX.Tests": "Dapper.DNX.Tests"
},
"compilationOptions": {"define": ["ASYNC"]},
"frameworks": {
"net45": {
"dependencies": {
},
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
},
//"net40": {
// "dependencies": {
// },
// "frameworkAssemblies": {
// "System.Data": "4.0.0.0"
// }
//},
"dnx451": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
},
//"dnxcore50" : {
// "dependencies": {
// "System.Console": "4.0.0-beta-22716"
// }
//}
}
}
{
"locked": false,
"version": -9998,
"projectFileDependencyGroups": {
"": [
"Dapper >= 1.40-*"
],
".NETFramework,Version=v4.5": [
"framework/System.Data >= 4.0.0.0"
],
"DNX,Version=v4.5.1": [
"framework/System.Data >= 4.0.0.0"
]
},
"libraries": {}
}
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22728.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Dapper", "Dapper\Dapper.xproj", "{088D8CC4-E71E-44B6-9B87-4060B043983D}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Dapper.DNX.Tests", "Dapper.DNX.Tests\Dapper.DNX.Tests.xproj", "{B6EAE030-3119-49C0-ADB5-39E25BA60C4C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{03340C6E-4176-4C42-9C76-D5DFC79D1A22}"
ProjectSection(SolutionItems) = preProject
Dapper NET40\SqlMapper.cs = Dapper NET40\SqlMapper.cs
Dapper NET45\SqlMapperAsync.cs = Dapper NET45\SqlMapperAsync.cs
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{088D8CC4-E71E-44B6-9B87-4060B043983D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{088D8CC4-E71E-44B6-9B87-4060B043983D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{088D8CC4-E71E-44B6-9B87-4060B043983D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{088D8CC4-E71E-44B6-9B87-4060B043983D}.Release|Any CPU.Build.0 = Release|Any CPU
{B6EAE030-3119-49C0-ADB5-39E25BA60C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6EAE030-3119-49C0-ADB5-39E25BA60C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6EAE030-3119-49C0-ADB5-39E25BA60C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6EAE030-3119-49C0-ADB5-39E25BA60C4C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B83D86B2-79C0-46AA-B51B-03730256FAAC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Dapper.SqlBuilder</RootNamespace>
<AssemblyName>Dapper.SqlBuilder</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Dapper.SqlBuilder\SqlBuilder.cs">
<Link>SqlBuilder.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper NET45\Dapper NET45.csproj">
<Project>{0fff5bc7-0a4b-4d87-835e-4fad70937507}</Project>
<Name>Dapper NET45</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dapper.SqlBuilder NET45")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Dapper.SqlBuilder NET45")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4db43514-7c62-4c98-a5f3-047110c106bb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Dapper.SqlBuilder</id>
<version>1.40.0</version>
<authors>Sam Saffron,Johan Danforth</authors>
<owners>Sam Saffron,Johan Danforth</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>http://code.google.com/p/dapper-dot-net/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<title>Dapper SqlBuilder component</title>
<description>The Dapper SqlBuilder component to build SQL queries dynamically.</description>
<tags>orm sql micro-orm query sql sql-builder</tags>
<dependencies>
<dependency id="Dapper" version="1.40" />
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
<frameworkAssembly assemblyName="System.Data" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
<frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
</frameworkAssemblies>
</metadata>
<files>
<file src="Dapper.SqlBuilder NET45\bin\Release\Dapper.SqlBuilder.*" target="lib\net45" />
<file src="Dapper.SqlBuilder\bin\Release\Dapper.SqlBuilder.*" target="lib\net40" />
</files>
</package>
\ No newline at end of file
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>Dapper.StrongName</id>
<version>1.39</version>
<version>1.40</version>
<title>Dapper dot net (strong named)</title>
<authors>Sam Saffron,Marc Gravell</authors>
<owners>Sam Saffron,Marc Gravell</owners>
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.22728.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DapperTests NET40", "Tests\DapperTests NET40.csproj", "{A2A80512-11F4-4028-A995-505463632C84}"
EndProject
......@@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Dapper.EntityFramework.StrongName.nuspec = Dapper.EntityFramework.StrongName.nuspec
Dapper.nuspec = Dapper.nuspec
Dapper.Rainbow.nuspec = Dapper.Rainbow.nuspec
Dapper.SqlBuilder.nuspec = Dapper.SqlBuilder.nuspec
Dapper.StrongName.nuspec = Dapper.StrongName.nuspec
License.txt = License.txt
EndProjectSection
......@@ -59,6 +60,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.EntityFramework NET4
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.EntityFramework NET45 SNK", "Dapper.EntityFramework NET45 SNK\Dapper.EntityFramework NET45 SNK.csproj", "{7169A2C1-F57E-4288-B22D-52394DD2EC06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.SqlBuilder NET45", "Dapper.SqlBuilder NET45\Dapper.SqlBuilder NET45.csproj", "{B83D86B2-79C0-46AA-B51B-03730256FAAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -269,6 +272,16 @@ Global
{7169A2C1-F57E-4288-B22D-52394DD2EC06}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7169A2C1-F57E-4288-B22D-52394DD2EC06}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7169A2C1-F57E-4288-B22D-52394DD2EC06}.Release|x86.ActiveCfg = Release|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Debug|x86.ActiveCfg = Debug|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Release|Any CPU.Build.0 = Release|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B83D86B2-79C0-46AA-B51B-03730256FAAC}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>088d8cc4-e71e-44b6-9b87-4060b043983d</ProjectGuid>
<RootNamespace>Dapper</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AssemblyName>Dapper</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
\ No newline at end of file
{
"authors": [ "Sam Saffron", "Marc Gravell" ],
"description": "A high performance Micro-ORM supporting Sql Server, MySQL, Sqlite, SqlCE, Firebird etc..",
"version": "1.40-*",
"code": [ "../Dapper NET40/*.cs", "../Dapper NET45/*.cs" ],
"frameworks": {
"net45": {
"compilationOptions": { "define": [ "ASYNC" ] },
"dependencies": {
},
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
},
//"net40": {
// "dependencies": {
// },
// "frameworkAssemblies": {
// "System.Data": "4.0.0.0"
// }
//},
"dnx451": {
"compilationOptions": { "define": [ "ASYNC" ] },
"dependencies": {
},
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
},
//"dnxcore50": {
// "dependencies": {
// "System.Runtime": "4.0.20-beta-22716"
// }
//}
}
}
{
"locked": false,
"version": -9998,
"projectFileDependencyGroups": {
"": [],
".NETFramework,Version=v4.5": [
"framework/System.Data >= 4.0.0.0"
],
"DNX,Version=v4.5.1": [
"framework/System.Data >= 4.0.0.0"
]
},
"libraries": {}
}
\ No newline at end of file
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.39.0.0")]
[assembly: AssemblyFileVersion("1.39.0.0")]
[assembly: AssemblyVersion("1.40.0.0")]
[assembly: AssemblyFileVersion("1.40.0.0")]
......@@ -19,6 +19,7 @@
using Microsoft.SqlServer.Types;
using System.Data.SqlTypes;
using FirebirdSql.Data.FirebirdClient;
using System.Diagnostics;
#if POSTGRESQL
using Npgsql;
#endif
......@@ -1571,10 +1572,10 @@ public void TestMultiMappingWithNonReturnedProperty()
2 as BlogId, 'Blog' as Title";
var postWithBlog = connection.Query<Post_DupeProp, Blog_DupeProp, Post_DupeProp>(sql,
(p, b) =>
{
p.Blog = b;
return p;
}, splitOn: "BlogId").First();
{
p.Blog = b;
return p;
}, splitOn: "BlogId").First();
postWithBlog.PostId.IsEqualTo(1);
postWithBlog.Title.IsEqualTo("Title");
......@@ -1830,15 +1831,15 @@ public void ParentChildIdentityAssociations()
var lookup = new Dictionary<int, Parent>();
var parents = connection.Query<Parent, Child, Parent>(@"select 1 as [Id], 1 as [Id] union all select 1,2 union all select 2,3 union all select 1,4 union all select 3,5",
(parent, child) =>
{
Parent found;
if (!lookup.TryGetValue(parent.Id, out found))
{
lookup.Add(parent.Id, found = parent);
}
found.Children.Add(child);
return found;
}).Distinct().ToDictionary(p => p.Id);
Parent found;
if (!lookup.TryGetValue(parent.Id, out found))
{
lookup.Add(parent.Id, found = parent);
}
found.Children.Add(child);
return found;
}).Distinct().ToDictionary(p => p.Id);
parents.Count().IsEqualTo(3);
parents[1].Children.Select(c => c.Id).SequenceEqual(new[] { 1, 2, 4 }).IsTrue();
parents[2].Children.Select(c => c.Id).SequenceEqual(new[] { 3 }).IsTrue();
......@@ -2782,9 +2783,9 @@ public void TestIssue131()
var results = connection.Query<dynamic, int, dynamic>(
"SELECT 1 Id, 'Mr' Title, 'John' Surname, 4 AddressCount",
(person, addressCount) =>
{
return person;
},
{
return person;
},
splitOn: "AddressCount"
).FirstOrDefault();
......@@ -3175,9 +3176,12 @@ class HasDoubleDecimal
public void DataTableParameters()
{
try { connection.Execute("drop proc #DataTableParameters"); } catch { }
try { connection.Execute("drop table #DataTableParameters"); } catch { }
try { connection.Execute("drop type MyTVPType"); } catch { }
try { connection.Execute("drop proc #DataTableParameters"); }
catch { }
try { connection.Execute("drop table #DataTableParameters"); }
catch { }
try { connection.Execute("drop type MyTVPType"); }
catch { }
connection.Execute("create type MyTVPType as table (id int)");
connection.Execute("create proc #DataTableParameters @ids MyTVPType readonly as select count(1) from @ids");
......@@ -3193,7 +3197,8 @@ public void DataTableParameters()
{
connection.Query<int>("select count(1) from @ids", new { ids = table.AsTableValuedParameter() }).First();
throw new InvalidOperationException();
} catch (Exception ex)
}
catch (Exception ex)
{
ex.Message.Equals("The table type parameter 'ids' must have a valid type name.");
}
......@@ -3220,12 +3225,14 @@ public void SO29533765_DataTableParametersViaDynamicParameters()
public void SO26468710_InWithTVPs()
{
// this is just to make it re-runnable; normally you only do this once
try { connection.Execute("drop type MyIdList"); } catch { }
try { connection.Execute("drop type MyIdList"); }
catch { }
connection.Execute("create type MyIdList as table(id int);");
DataTable ids = new DataTable {
Columns = {{"id", typeof(int)}},
Rows = {{1},{3},{5}}
DataTable ids = new DataTable
{
Columns = { { "id", typeof(int) } },
Rows = { { 1 }, { 3 }, { 5 } }
};
ids.SetTypeName("MyIdList");
int sum = connection.Query<int>(@"
......@@ -3236,9 +3243,12 @@ public void SO26468710_InWithTVPs()
}
public void DataTableParametersWithExtendedProperty()
{
try { connection.Execute("drop proc #DataTableParameters"); } catch { }
try { connection.Execute("drop table #DataTableParameters"); } catch { }
try { connection.Execute("drop type MyTVPType"); } catch { }
try { connection.Execute("drop proc #DataTableParameters"); }
catch { }
try { connection.Execute("drop table #DataTableParameters"); }
catch { }
try { connection.Execute("drop type MyTVPType"); }
catch { }
connection.Execute("create type MyTVPType as table (id int)");
connection.Execute("create proc #DataTableParameters @ids MyTVPType readonly as select count(1) from @ids");
......@@ -3643,7 +3653,8 @@ public class LocalDateResult
public LocalDate? NullableIsNull { get; set; }
}
public class LotsOfNumerics {
public class LotsOfNumerics
{
public enum E_Byte : byte { A = 0, B = 1 }
public enum E_SByte : sbyte { A = 0, B = 1 }
public enum E_Short : short { A = 0, B = 1 }
......@@ -3851,7 +3862,8 @@ public void SO25069578_DynamicParams_Procs()
var parameters = new DynamicParameters();
parameters.Add("foo", "bar");
// parameters = new DynamicParameters(parameters);
try { connection.Execute("drop proc SO25069578"); } catch { }
try { connection.Execute("drop proc SO25069578"); }
catch { }
connection.Execute("create proc SO25069578 @foo nvarchar(max) as select @foo as [X]");
var tran = connection.BeginTransaction(); // gist used transaction; behaves the same either way, though
var row = connection.Query<HazX>("SO25069578", parameters,
......@@ -3868,14 +3880,15 @@ public void Issue149_TypeMismatch_SequentialAccess()
{
var result = connection.Query<Issue149_Person>(@"select @guid as Id", new { guid }).First();
error = null;
} catch(Exception ex)
}
catch (Exception ex)
{
error = ex.Message;
}
error.IsEqualTo("Error parsing column 0 (Id=cf0ef7ac-b6fe-4e24-aeda-a2b45bb5654e - Object)");
}
public class Issue149_Person { public string Id { get; set; } }
public class HazX
{
public string X { get; set; }
......@@ -3897,7 +3910,7 @@ public void SO25297173_DynamicIn()
var queryParams = new Dictionary<string, object> {
{ "myIds", new [] { 5, 6 } }
};
var dynamicParams = new DynamicParameters(queryParams);
List<int> result = connection.Query<int>(query, dynamicParams).ToList();
result.Count.IsEqualTo(2);
......@@ -3919,8 +3932,10 @@ public void AllowIDictionaryParameters()
public void Issue178_SqlServer()
{
const string sql = @"select count(*) from Issue178";
try { connection.Execute("drop table Issue178"); } catch { }
try { connection.Execute("create table Issue178(id int not null)"); } catch { }
try { connection.Execute("drop table Issue178"); }
catch { }
try { connection.Execute("create table Issue178(id int not null)"); }
catch { }
// raw ADO.net
var sqlCmd = new SqlCommand(sql, connection);
using (IDataReader reader1 = sqlCmd.ExecuteReader())
......@@ -3949,7 +3964,8 @@ public void Issue178_SqlServer()
{
connection.Open();
const string sql = @"select count(*) from Issue178";
try { connection.Execute("drop table Issue178"); } catch { }
try { connection.Execute("drop table Issue178"); }
catch { }
connection.Execute("create table Issue178(id int not null)");
connection.Execute("insert into Issue178(id) values(42)");
// raw ADO.net
......@@ -4074,7 +4090,7 @@ public class Dyno
public dynamic Id { get; set; }
public string Name { get; set; }
public object Foo { get;set; }
public object Foo { get; set; }
}
public void Issue151_ExpandoObjectArgsQuery()
......@@ -4166,8 +4182,43 @@ public void ExplicitConstructors()
public void Issue220_InParameterCanBeSpecifiedInAnyCase()
{
// note this might fail if your database server is case-sensitive
connection.Query<int>("select * from (select 1 as Id) as X where Id in @ids", new {Ids = new[] {1}})
.IsSequenceEqualTo(new[] {1});
connection.Query<int>("select * from (select 1 as Id) as X where Id in @ids", new { Ids = new[] { 1 } })
.IsSequenceEqualTo(new[] { 1 });
}
public void SO29343103_UtcDates()
{
const string sql = "select @date";
var date = DateTime.UtcNow;
var returned = connection.Query<DateTime>(sql, new { date }).Single();
var delta = returned - date;
Assert.IsTrue(delta.TotalMilliseconds >= -1 && delta.TotalMilliseconds <= 1);
}
public void Issue261_Decimals()
{
var parameters = new DynamicParameters();
parameters.Add("c", dbType: DbType.Decimal, direction: ParameterDirection.Output, precision: 10, scale: 5);
connection.Execute("create proc #Issue261 @c decimal(10,5) OUTPUT as begin set @c=11.884 end");
connection.Execute("#Issue261", parameters, commandType: CommandType.StoredProcedure);
var c = parameters.Get<Decimal>("c");
c.IsEqualTo(11.884M);
}
public void BasicDecimals()
{
var c = connection.Query<decimal>("select @c", new { c = 11.884M }).Single();
c.IsEqualTo(11.884M);
}
public void Issue263_Timeout()
{
var watch = Stopwatch.StartNew();
var i = connection.Query<int>("waitfor delay '00:01:00'; select 42;", commandTimeout: 300, buffered: false).Single();
watch.Stop();
i.IsEqualTo(42);
var minutes = watch.ElapsedMilliseconds / 1000 / 60;
Assert.IsTrue(minutes >= 0.95 && minutes <= 1.05);
}
#if POSTGRESQL
......
......@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>Dapper</id>
<version>1.39</version>
<version>1.40</version>
<title>Dapper dot net</title>
<authors>Sam Saffron,Marc Gravell</authors>
<owners>Sam Saffron,Marc Gravell</owners>
......@@ -19,6 +19,7 @@
<frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework=".NETFramework4.0-Client, .NETFramework4.0" />
</frameworkAssemblies>
<releaseNotes>
* 1.40 - workaround for broken GetValues() on Mono; add AsList()
* 1.39 - fix case on SQL CLR types; grid-reader should respect no-cache flags; make parameter inclusion case-insensitive
* 1.38 - specify constructor explicitly; allow value-type parameters (albeit: boxed)
* 1.37 - Reuse StringBuilder instances when possible (list parameters in particular)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment