diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index af17f43c..00000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Dapper.Contrib/Dapper.Contrib.1.0.nupkg b/Dapper.Contrib/Dapper.Contrib.1.0.nupkg
deleted file mode 100644
index 3ff7c017..00000000
Binary files a/Dapper.Contrib/Dapper.Contrib.1.0.nupkg and /dev/null differ
diff --git a/Dapper.Contrib/Dapper.Contrib.csproj b/Dapper.Contrib/Dapper.Contrib.csproj
new file mode 100644
index 00000000..d2045728
--- /dev/null
+++ b/Dapper.Contrib/Dapper.Contrib.csproj
@@ -0,0 +1,27 @@
+
+
+ Dapper.Contrib
+ orm;sql;micro-orm;dapper
+ Dapper.Contrib
+ The official collection of get, insert, update and delete helpers for Dapper.net. Also handles lists of entities and optional "dirty" tracking of interface-based entities.
+ Sam Saffron;Johan Danforth
+ net40;net45;netstandard1.3
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dapper.Contrib/Dapper.Contrib.xproj b/Dapper.Contrib/Dapper.Contrib.xproj
deleted file mode 100644
index 1ae445ae..00000000
--- a/Dapper.Contrib/Dapper.Contrib.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 4e409f8f-cfbb-4332-8b0a-fd5a283051fd
- Dapper.Contrib
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.Contrib/Properties/AssemblyInfo.cs b/Dapper.Contrib/Properties/AssemblyInfo.cs
deleted file mode 100644
index de92a912..00000000
--- a/Dapper.Contrib/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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.Contrib")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("Dapper.Contrib")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
-[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("6dde1c15-4e92-45e7-93fc-88778d15ff31")]
-
-// 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.50.0.0")]
-[assembly: AssemblyFileVersion("1.50.0.0")]
diff --git a/Dapper.Contrib/project.json b/Dapper.Contrib/project.json
deleted file mode 100644
index 3d510c94..00000000
--- a/Dapper.Contrib/project.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "packOptions": {
- "summary": "Dapper.Contrib",
- "tags": [ "orm", "sql", "micro-orm", "dapper" ],
- "owners": [ "johandanforth", "marc.gravell", "nick.craver" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Sam Saffron", "Johan Danforth" ],
- "description": "The official collection of get, insert, update and delete helpers for dapper.net. Also handles lists of entities and optional \"dirty\" tracking of interface-based entities.",
- "version": "1.50.2-*",
- "title": "Dapper.Contrib",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- "Dapper": {
- "version": "1.50.2-*",
- "target": "project"
- }
- },
- "buildOptions": {
- "warningsAsErrors": true,
- "compile": {
- "include": [
- "**/*.cs"
- ],
- "includeFiles": [
- "../Dapper/TypeExtensions.cs"
- ]
- }
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- },
- "dependencies": {
- }
- },
- "netstandard1.3": {
- "buildOptions": {
- "define": [ "ASYNC", "COREFX" ]
- },
- "dependencies": {
- "Microsoft.CSharp": "4.0.1"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.xproj b/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.xproj
deleted file mode 100644
index e7adcfc7..00000000
--- a/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 1a70b6d7-244e-41ed-8ff5-6f0e8e26a764
- Dapper.EntityFramework.StrongName
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.EntityFramework.StrongName/project.json b/Dapper.EntityFramework.StrongName/project.json
deleted file mode 100644
index 0475f7cd..00000000
--- a/Dapper.EntityFramework.StrongName/project.json
+++ /dev/null
@@ -1,66 +0,0 @@
-{
- "packOptions": {
- "summary": "Adds support for DbGeography, etc.",
- "tags": [ "orm", "sql", "micro-orm" ],
- "owners": [ "marc.gravell", "nick.craver" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Marc Gravell", "Nick Craver" ],
- "description": "Extension handlers for entity framework",
- "version": "1.50.2-*",
- "title": "Dapper entity framework type handlers (with a strong name)",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- "Dapper.StrongName": {
- "version": "1.50.2-*",
- "target": "project"
- }
- },
- "buildOptions": {
- "xmlDoc": true,
- "warningsAsErrors": true,
- "keyFile": "../Dapper.snk",
- "compile": {
- "include": [
- "../Dapper.EntityFramework/**/*.cs"
- ],
- "exclude": [
- "../Dapper.EntityFramework/obj/"
- ]
- }
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0",
- "System.Xml": "4.0.0.0"
- },
- "dependencies": {
- "EntityFramework": "6.1.3",
- "Microsoft.SqlServer.Types": "11.0.2"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0",
- "System.Xml": "4.0.0.0"
- },
- "dependencies": {
- "EntityFramework": "6.1.3",
- "Microsoft.SqlServer.Types": "11.0.2"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.EntityFramework/Dapper.EntityFramework.StrongName.csproj b/Dapper.EntityFramework/Dapper.EntityFramework.StrongName.csproj
new file mode 100644
index 00000000..b74179dd
--- /dev/null
+++ b/Dapper.EntityFramework/Dapper.EntityFramework.StrongName.csproj
@@ -0,0 +1,25 @@
+
+
+ Dapper.EntityFramework.StrongName
+ Dapper: Entity Framework type handlers (with a strong name)
+ Extension handlers for entity framework
+ Marc Gravell;Nick Craver
+ net40;net45
+ ../Dapper.snk
+ true
+ true
+ Dapper.EntityFramework.StrongName
+ orm;sql;micro-orm
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Dapper.EntityFramework/Dapper.EntityFramework.csproj b/Dapper.EntityFramework/Dapper.EntityFramework.csproj
new file mode 100644
index 00000000..f4fb3d22
--- /dev/null
+++ b/Dapper.EntityFramework/Dapper.EntityFramework.csproj
@@ -0,0 +1,22 @@
+
+
+ Dapper.EntityFramework
+ Extension handlers for entity framework
+ Dapper entity framework type handlers
+ 1.50.2
+ Marc Gravell;Nick Craver
+ net40;net45
+ orm;sql;micro-orm
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dapper.EntityFramework/Dapper.EntityFramework.xproj b/Dapper.EntityFramework/Dapper.EntityFramework.xproj
deleted file mode 100644
index d1164faa..00000000
--- a/Dapper.EntityFramework/Dapper.EntityFramework.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- be401f7b-8611-4a1e-aeaa-5cb700128c16
- Dapper.EntityFramework
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.EntityFramework/Properties/AssemblyInfo.cs b/Dapper.EntityFramework/Properties/AssemblyInfo.cs
deleted file mode 100644
index 790774b6..00000000
--- a/Dapper.EntityFramework/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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.EntityFramework")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Dapper.EntityFramework")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[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("2400e6b9-a925-45d8-ab5a-07f119b0eedb")]
-
-// 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.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Dapper.EntityFramework/project.json b/Dapper.EntityFramework/project.json
deleted file mode 100644
index 58e081c0..00000000
--- a/Dapper.EntityFramework/project.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "packOptions": {
- "summary": "Adds support for DbGeography, etc.",
- "tags": [ "orm", "sql", "micro-orm" ],
- "owners": [ "marc.gravell", "nick.craver" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Marc Gravell", "Nick Craver" ],
- "description": "Extension handlers for entity framework",
- "version": "1.50.2-*",
- "title": "Dapper entity framework type handlers",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- "Dapper": {
- "version": "1.50.2-*",
- "target": "project"
- }
- },
- "buildOptions": {
- "xmlDoc": true,
- "warningsAsErrors": true
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0",
- "System.Xml": "4.0.0.0"
- },
- "dependencies": {
- "EntityFramework": "6.1.3",
- "Microsoft.SqlServer.Types": "11.0.2"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0",
- "System.Xml": "4.0.0.0"
- },
- "dependencies": {
- "EntityFramework": "6.1.3",
- "Microsoft.SqlServer.Types": "11.0.2"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.Rainbow/Dapper.Rainbow.csproj b/Dapper.Rainbow/Dapper.Rainbow.csproj
new file mode 100644
index 00000000..84ce55ac
--- /dev/null
+++ b/Dapper.Rainbow/Dapper.Rainbow.csproj
@@ -0,0 +1,29 @@
+
+
+ Dapper.Rainbow
+ orm;sql;micro-orm
+ Dapper.Rainbow
+ Trivial micro-orm implemented on Dapper, provides with CRUD helpers.
+ Sam Saffron
+ 2017 Sam Saffron
+ net40;net45;netstandard1.3
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dapper.Rainbow/Dapper.Rainbow.xproj b/Dapper.Rainbow/Dapper.Rainbow.xproj
deleted file mode 100644
index 1f09cf7f..00000000
--- a/Dapper.Rainbow/Dapper.Rainbow.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 8a74f0b6-188f-45d2-8a4b-51e4f211805a
- Dapper.Rainbow
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.Rainbow/Database.cs b/Dapper.Rainbow/Database.cs
index 109089f8..d0f6c48b 100644
--- a/Dapper.Rainbow/Database.cs
+++ b/Dapper.Rainbow/Database.cs
@@ -106,7 +106,7 @@ public IEnumerable All()
return database.Query("select * from " + TableName);
}
- static ConcurrentDictionary> paramNameCache = new ConcurrentDictionary>();
+ private static ConcurrentDictionary> paramNameCache = new ConcurrentDictionary>();
internal static List GetParamNames(object o)
{
@@ -127,7 +127,7 @@ internal static List GetParamNames(object o)
if (attr==null || (!attr.Value))
{
paramNames.Add(prop.Name);
- }
+ }
}
paramNameCache[o.GetType()] = paramNames;
}
@@ -142,9 +142,9 @@ public Table(Database database, string likelyTableName)
}
}
- DbConnection _connection;
- int _commandTimeout;
- DbTransaction _transaction;
+ private DbConnection _connection;
+ private int _commandTimeout;
+ private DbTransaction _transaction;
public static TDatabase Init(DbConnection connection, int commandTimeout)
{
@@ -240,7 +240,7 @@ protected Action CreateTableConstructor(params Type[] tableTypes)
return (Action)dm.CreateDelegate(typeof(Action));
}
- static ConcurrentDictionary tableNameMap = new ConcurrentDictionary();
+ private static ConcurrentDictionary tableNameMap = new ConcurrentDictionary();
private string DetermineTableName(string likelyTableName)
{
string name;
diff --git a/Dapper.Rainbow/Properties/AssemblyInfo.cs b/Dapper.Rainbow/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8ea5cd0f..00000000
--- a/Dapper.Rainbow/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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.Rainbow")]
-[assembly: AssemblyDescription("I sample mini ORM implementation using Dapper")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Dapper.Rainbow")]
-[assembly: AssemblyCopyright("Sam Saffron Copyright © 2012")]
-[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("e763c106-eef4-4654-afcc-c28fded057e5")]
-
-// 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("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
diff --git a/Dapper.Rainbow/Snapshotter.cs b/Dapper.Rainbow/Snapshotter.cs
index f4bc57cb..043f2b42 100644
--- a/Dapper.Rainbow/Snapshotter.cs
+++ b/Dapper.Rainbow/Snapshotter.cs
@@ -1,203 +1,200 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Reflection.Emit;
-
-namespace Dapper
-{
- public static class Snapshotter
- {
- public static Snapshot Start(T obj)
- {
- return new Snapshot(obj);
- }
-
- public class Snapshot
- {
- static Func cloner;
- static Func> differ;
- T memberWiseClone;
- T trackedObject;
-
- public Snapshot(T original)
- {
- memberWiseClone = Clone(original);
- trackedObject = original;
- }
-
- public class Change
- {
- public string Name { get; set; }
- public object NewValue { get; set; }
- }
-
- public DynamicParameters Diff()
- {
- return Diff(memberWiseClone, trackedObject);
- }
-
-
- private static T Clone(T myObject)
- {
- cloner = cloner ?? GenerateCloner();
- return cloner(myObject);
- }
-
- private static DynamicParameters Diff(T original, T current)
- {
- var dm = new DynamicParameters();
- differ = differ ?? GenerateDiffer();
- foreach (var pair in differ(original, current))
- {
- dm.Add(pair.Name, pair.NewValue);
- }
- return dm;
- }
-
-
- static List RelevantProperties()
- {
- return typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
- .Where(p =>
- p.GetSetMethod(true) != null &&
- p.GetGetMethod(true) != null &&
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Dapper
+{
+ public static class Snapshotter
+ {
+ public static Snapshot Start(T obj)
+ {
+ return new Snapshot(obj);
+ }
+
+ public class Snapshot
+ {
+ static Func cloner;
+ static Func> differ;
+ T memberWiseClone;
+ T trackedObject;
+
+ public Snapshot(T original)
+ {
+ memberWiseClone = Clone(original);
+ trackedObject = original;
+ }
+
+ public class Change
+ {
+ public string Name { get; set; }
+ public object NewValue { get; set; }
+ }
+
+ public DynamicParameters Diff()
+ {
+ return Diff(memberWiseClone, trackedObject);
+ }
+
+ private static T Clone(T myObject)
+ {
+ cloner = cloner ?? GenerateCloner();
+ return cloner(myObject);
+ }
+
+ private static DynamicParameters Diff(T original, T current)
+ {
+ var dm = new DynamicParameters();
+ differ = differ ?? GenerateDiffer();
+ foreach (var pair in differ(original, current))
+ {
+ dm.Add(pair.Name, pair.NewValue);
+ }
+ return dm;
+ }
+
+ static List RelevantProperties()
+ {
+ return typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
+ .Where(p =>
+ p.GetSetMethod(true) != null &&
+ p.GetGetMethod(true) != null &&
(p.PropertyType == typeof(string) ||
- p.PropertyType.IsValueType() ||
- (p.PropertyType.IsGenericType() && p.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)))
- ).ToList();
- }
-
- // This is used by IL, ReSharper is wrong.
+ p.PropertyType.IsValueType() ||
+ (p.PropertyType.IsGenericType() && p.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)))
+ ).ToList();
+ }
+
+ // This is used by IL, ReSharper is wrong.
// ReSharper disable UnusedMember.Local
- private static bool AreEqual(U first, U second)
- {
- if (first == null && second == null) return true;
- if (first == null) return false;
- return first.Equals(second);
+ private static bool AreEqual(U first, U second)
+ {
+ if (first == null && second == null) return true;
+ if (first == null) return false;
+ return first.Equals(second);
}
// ReSharper restore UnusedMember.Local
- private static Func> GenerateDiffer()
- {
-
- var dm = new DynamicMethod("DoDiff", typeof(List), new[] { typeof(T), typeof(T) }, true);
-
- var il = dm.GetILGenerator();
- // change list
- il.DeclareLocal(typeof(List));
- il.DeclareLocal(typeof(Change));
- il.DeclareLocal(typeof(object)); // boxed change
-
- il.Emit(OpCodes.Newobj, typeof(List).GetConstructor(Type.EmptyTypes));
- // [list]
- il.Emit(OpCodes.Stloc_0);
-
- foreach (var prop in RelevantProperties())
- {
- // []
- il.Emit(OpCodes.Ldarg_0);
- // [original]
- il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
- // [original prop val]
- il.Emit(OpCodes.Ldarg_1);
- // [original prop val, current]
- il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
- // [original prop val, current prop val]
-
- il.Emit(OpCodes.Dup);
- // [original prop val, current prop val, current prop val]
-
- if (prop.PropertyType != typeof(string))
- {
- il.Emit(OpCodes.Box, prop.PropertyType);
- // [original prop val, current prop val, current prop val boxed]
- }
-
- il.Emit(OpCodes.Stloc_2);
- // [original prop val, current prop val]
-
- il.EmitCall(OpCodes.Call, typeof(Snapshot).GetMethod("AreEqual", BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(new Type[] { prop.PropertyType }), null);
- // [result]
-
- Label skip = il.DefineLabel();
- il.Emit(OpCodes.Brtrue_S, skip);
- // []
-
- il.Emit(OpCodes.Newobj, typeof(Change).GetConstructor(Type.EmptyTypes));
- // [change]
- il.Emit(OpCodes.Dup);
- // [change,change]
-
- il.Emit(OpCodes.Stloc_1);
- // [change]
-
- il.Emit(OpCodes.Ldstr, prop.Name);
- // [change, name]
- il.Emit(OpCodes.Callvirt, typeof(Change).GetMethod("set_Name"));
- // []
-
- il.Emit(OpCodes.Ldloc_1);
- // [change]
-
- il.Emit(OpCodes.Ldloc_2);
- // [change, boxed]
-
- il.Emit(OpCodes.Callvirt, typeof(Change).GetMethod("set_NewValue"));
- // []
-
- il.Emit(OpCodes.Ldloc_0);
- // [change list]
- il.Emit(OpCodes.Ldloc_1);
- // [change list, change]
- il.Emit(OpCodes.Callvirt, typeof(List).GetMethod("Add"));
- // []
-
- il.MarkLabel(skip);
- }
-
- il.Emit(OpCodes.Ldloc_0);
- // [change list]
- il.Emit(OpCodes.Ret);
-
- return (Func>)dm.CreateDelegate(typeof(Func>));
- }
-
-
- // adapted from http://stackoverflow.com/a/966466/17174
- private static Func GenerateCloner()
- {
- var dm = new DynamicMethod("DoClone", typeof(T), new Type[] { typeof(T) }, true);
- var ctor = typeof(T).GetConstructor(new Type[] { });
-
- var il = dm.GetILGenerator();
-
- il.DeclareLocal(typeof(T));
-
- il.Emit(OpCodes.Newobj, ctor);
- il.Emit(OpCodes.Stloc_0);
-
- foreach (var prop in RelevantProperties())
- {
- il.Emit(OpCodes.Ldloc_0);
- // [clone]
- il.Emit(OpCodes.Ldarg_0);
- // [clone, source]
- il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
- // [clone, source val]
- il.Emit(OpCodes.Callvirt, prop.GetSetMethod(true));
- // []
- }
-
- // Load new constructed obj on eval stack -> 1 item on stack
- il.Emit(OpCodes.Ldloc_0);
- // Return constructed object. --> 0 items on stack
- il.Emit(OpCodes.Ret);
-
- var myExec = dm.CreateDelegate(typeof(Func));
-
- return (Func)myExec;
- }
- }
- }
-}
+ private static Func> GenerateDiffer()
+ {
+ var dm = new DynamicMethod("DoDiff", typeof(List), new[] { typeof(T), typeof(T) }, true);
+
+ var il = dm.GetILGenerator();
+ // change list
+ il.DeclareLocal(typeof(List));
+ il.DeclareLocal(typeof(Change));
+ il.DeclareLocal(typeof(object)); // boxed change
+
+ il.Emit(OpCodes.Newobj, typeof(List).GetConstructor(Type.EmptyTypes));
+ // [list]
+ il.Emit(OpCodes.Stloc_0);
+
+ foreach (var prop in RelevantProperties())
+ {
+ // []
+ il.Emit(OpCodes.Ldarg_0);
+ // [original]
+ il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
+ // [original prop val]
+ il.Emit(OpCodes.Ldarg_1);
+ // [original prop val, current]
+ il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
+ // [original prop val, current prop val]
+
+ il.Emit(OpCodes.Dup);
+ // [original prop val, current prop val, current prop val]
+
+ if (prop.PropertyType != typeof(string))
+ {
+ il.Emit(OpCodes.Box, prop.PropertyType);
+ // [original prop val, current prop val, current prop val boxed]
+ }
+
+ il.Emit(OpCodes.Stloc_2);
+ // [original prop val, current prop val]
+
+ il.EmitCall(OpCodes.Call, typeof(Snapshot).GetMethod("AreEqual", BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(new Type[] { prop.PropertyType }), null);
+ // [result]
+
+ Label skip = il.DefineLabel();
+ il.Emit(OpCodes.Brtrue_S, skip);
+ // []
+
+ il.Emit(OpCodes.Newobj, typeof(Change).GetConstructor(Type.EmptyTypes));
+ // [change]
+ il.Emit(OpCodes.Dup);
+ // [change,change]
+
+ il.Emit(OpCodes.Stloc_1);
+ // [change]
+
+ il.Emit(OpCodes.Ldstr, prop.Name);
+ // [change, name]
+ il.Emit(OpCodes.Callvirt, typeof(Change).GetMethod("set_Name"));
+ // []
+
+ il.Emit(OpCodes.Ldloc_1);
+ // [change]
+
+ il.Emit(OpCodes.Ldloc_2);
+ // [change, boxed]
+
+ il.Emit(OpCodes.Callvirt, typeof(Change).GetMethod("set_NewValue"));
+ // []
+
+ il.Emit(OpCodes.Ldloc_0);
+ // [change list]
+ il.Emit(OpCodes.Ldloc_1);
+ // [change list, change]
+ il.Emit(OpCodes.Callvirt, typeof(List).GetMethod("Add"));
+ // []
+
+ il.MarkLabel(skip);
+ }
+
+ il.Emit(OpCodes.Ldloc_0);
+ // [change list]
+ il.Emit(OpCodes.Ret);
+
+ return (Func>)dm.CreateDelegate(typeof(Func>));
+ }
+
+
+ // adapted from https://stackoverflow.com/a/966466/17174
+ private static Func GenerateCloner()
+ {
+ var dm = new DynamicMethod("DoClone", typeof(T), new Type[] { typeof(T) }, true);
+ var ctor = typeof(T).GetConstructor(new Type[] { });
+
+ var il = dm.GetILGenerator();
+
+ il.DeclareLocal(typeof(T));
+
+ il.Emit(OpCodes.Newobj, ctor);
+ il.Emit(OpCodes.Stloc_0);
+
+ foreach (var prop in RelevantProperties())
+ {
+ il.Emit(OpCodes.Ldloc_0);
+ // [clone]
+ il.Emit(OpCodes.Ldarg_0);
+ // [clone, source]
+ il.Emit(OpCodes.Callvirt, prop.GetGetMethod(true));
+ // [clone, source val]
+ il.Emit(OpCodes.Callvirt, prop.GetSetMethod(true));
+ // []
+ }
+
+ // Load new constructed obj on eval stack -> 1 item on stack
+ il.Emit(OpCodes.Ldloc_0);
+ // Return constructed object. --> 0 items on stack
+ il.Emit(OpCodes.Ret);
+
+ var myExec = dm.CreateDelegate(typeof(Func));
+
+ return (Func)myExec;
+ }
+ }
+ }
+}
diff --git a/Dapper.Rainbow/project.json b/Dapper.Rainbow/project.json
deleted file mode 100644
index b2cdc1e2..00000000
--- a/Dapper.Rainbow/project.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "packOptions": {
- "summary": "A demo is available at https://gist.github.com/1599013",
- "tags": [ "orm", "sql", "micro-orm" ],
- "owners": [ "samsaffron" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Sam Saffron" ],
- "description": "Trivial micro-orm implemented on Dapper, provides with CRUD helpers.",
- "version": "0.1.3-beta1",
- "title": "Dapper.Rainbow",
- "copyright": "2012 Sam Saffron",
- "dependencies": {
- "Dapper": {
- "version": "1.50.2-*",
- "target": "project"
- }
- },
- "buildOptions": {
- "warningsAsErrors": true,
- "compile": {
- "include": [
- "**/*.cs"
- ],
- "includeFiles": [
- "../Dapper/TypeExtensions.cs"
- ]
- }
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Configuration": "4.0.0.0",
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- }
- },
- "netstandard1.3": {
- "buildOptions": {
- "define": [ "ASYNC", "COREFX" ]
- },
- "dependencies": {
- "Microsoft.CSharp": "4.0.1"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj b/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj
new file mode 100644
index 00000000..519a417a
--- /dev/null
+++ b/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj
@@ -0,0 +1,25 @@
+
+
+ Dapper.SqlBuilder
+ orm;sql;micro-orm;query;sql-builder
+ Dapper SqlBuilder component
+ The Dapper SqlBuilder component, for building SQL queries dynamically.
+ Sam Saffron, Johan Danforth
+ net40;net45;netstandard1.3
+
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dapper.SqlBuilder/Dapper.SqlBuilder.xproj b/Dapper.SqlBuilder/Dapper.SqlBuilder.xproj
deleted file mode 100644
index 90346437..00000000
--- a/Dapper.SqlBuilder/Dapper.SqlBuilder.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 196928f0-7052-4585-90e8-817bd720f5e3
- Dapper.SqlBuilder
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.SqlBuilder/Properties/AssemblyInfo.cs b/Dapper.SqlBuilder/Properties/AssemblyInfo.cs
deleted file mode 100644
index e49e8049..00000000
--- a/Dapper.SqlBuilder/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Dapper.SqlBuilder")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[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("27491c26-c95d-44e5-b907-30559ef11265")]
-
-// 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.50.0.0")]
-[assembly: AssemblyFileVersion("1.50.0.0")]
diff --git a/Dapper.SqlBuilder/SqlBuilder.cs b/Dapper.SqlBuilder/SqlBuilder.cs
index a395abe7..729ede03 100644
--- a/Dapper.SqlBuilder/SqlBuilder.cs
+++ b/Dapper.SqlBuilder/SqlBuilder.cs
@@ -21,7 +21,7 @@ class Clauses : List
private readonly string _joiner;
private readonly string _prefix;
private readonly string _postfix;
-
+
public Clauses(string joiner, string prefix = "", string postfix = "")
{
_joiner = joiner;
@@ -56,7 +56,7 @@ public class Template
private readonly SqlBuilder _builder;
private readonly object _initParams;
private int _dataSeq = -1; // Unresolved
-
+
public Template(SqlBuilder builder, string sql, dynamic parameters)
{
_initParams = parameters;
@@ -110,73 +110,73 @@ protected void AddClause(string name, string sql, object parameters, string join
clauses.Add(new Clause { Sql = sql, Parameters = parameters, IsInclusive = isInclusive });
_seq++;
}
-
+
public SqlBuilder Intersect(string sql, dynamic parameters = null)
{
AddClause("intersect", sql, parameters, "\nINTERSECT\n ", "\n ", "\n", false);
return this;
}
-
+
public SqlBuilder InnerJoin(string sql, dynamic parameters = null)
{
AddClause("innerjoin", sql, parameters, "\nINNER JOIN ", "\nINNER JOIN ", "\n", false);
return this;
}
-
+
public SqlBuilder LeftJoin(string sql, dynamic parameters = null)
{
AddClause("leftjoin", sql, parameters, "\nLEFT JOIN ", "\nLEFT JOIN ", "\n", false);
return this;
}
-
+
public SqlBuilder RightJoin(string sql, dynamic parameters = null)
{
AddClause("rightjoin", sql, parameters, "\nRIGHT JOIN ", "\nRIGHT JOIN ", "\n", false);
return this;
}
-
+
public SqlBuilder Where(string sql, dynamic parameters = null)
{
AddClause("where", sql, parameters, " AND ", "WHERE ", "\n", false);
return this;
}
-
+
public SqlBuilder OrWhere(string sql, dynamic parameters = null)
{
AddClause("where", sql, parameters, " OR ", "WHERE ", "\n", true);
return this;
}
-
+
public SqlBuilder OrderBy(string sql, dynamic parameters = null)
{
AddClause("orderby", sql, parameters, " , ", "ORDER BY ", "\n", false);
return this;
}
-
+
public SqlBuilder Select(string sql, dynamic parameters = null)
{
AddClause("select", sql, parameters, " , ", "", "\n", false);
return this;
}
-
+
public SqlBuilder AddParameters(dynamic parameters)
{
AddClause("--parameters", "", parameters, "", "", "", false);
return this;
}
-
+
public SqlBuilder Join(string sql, dynamic parameters = null)
{
AddClause("join", sql, parameters, "\nJOIN ", "\nJOIN ", "\n", false);
return this;
}
-
+
public SqlBuilder GroupBy(string sql, dynamic parameters = null)
{
AddClause("groupby", sql, parameters, " , ", "\nGROUP BY ", "\n", false);
return this;
}
-
+
public SqlBuilder Having(string sql, dynamic parameters = null)
{
AddClause("having", sql, parameters, "\nAND ", "HAVING ", "\n", false);
diff --git a/Dapper.SqlBuilder/project.json b/Dapper.SqlBuilder/project.json
deleted file mode 100644
index 1ef6e1bd..00000000
--- a/Dapper.SqlBuilder/project.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "packOptions": {
- "summary": "Dapper.SqlBuilder",
- "tags": [ "orm", "sql", "micro-orm", "query", "sql-builder" ],
- "owners": [ "AEckenberger", "nick.craver" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Sam Saffron, Johan Danforth" ],
- "description": "The Dapper SqlBuilder component, for building SQL queries dynamically.",
- "version": "1.50.2-*",
- "title": "Dapper SqlBuilder component",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- "Dapper": {
- "version": "1.50.2-*",
- "target": "project"
- }
- },
- "buildOptions": {
- "warningsAsErrors": true
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Data.Linq": "4.0.0.0"
- }
- },
- "netstandard1.3": {
- "buildOptions": {
- "define": [ "ASYNC", "COREFX" ]
- },
- "dependencies": {
- "Microsoft.CSharp": "4.0.1"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.StrongName/Dapper.StrongName.xproj b/Dapper.StrongName/Dapper.StrongName.xproj
deleted file mode 100644
index 5e17c192..00000000
--- a/Dapper.StrongName/Dapper.StrongName.xproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 549c51a1-222b-4e12-96f1-3aeff45a7709
- Dapper.StrongName
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/Dapper.StrongName/project.json b/Dapper.StrongName/project.json
deleted file mode 100644
index 487c0f72..00000000
--- a/Dapper.StrongName/project.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "packOptions": {
- "summary": "A high performance Micro-ORM",
- "tags": [ "orm", "sql", "micro-orm" ],
- "owners": [ "marc.gravell", "nick.craver" ],
- "releaseNotes": "http://stackexchange.github.io/dapper-dot-net/",
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Sam Saffron", "Marc Gravell", "Nick Craver" ],
- "description": "A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..",
- "version": "1.50.2-*",
- "title": "Dapper dot net (strong named)",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- },
- "buildOptions": {
- "xmlDoc": true,
- "keyFile": "../Dapper.snk",
- "warningsAsErrors": true,
- "compile": {
- "include": [
- "../Dapper/**/*.cs"
- ],
- "exclude": [
- "../Dapper/obj/"
- ]
- }
- },
- "frameworks": {
- "net40": {
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Xml": "4.0.0.0",
- "System.Xml.Linq": "4.0.0.0"
- }
- },
- "net45": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Xml": "4.0.0.0",
- "System.Xml.Linq": "4.0.0.0"
- }
- },
- "net451": {
- "buildOptions": {
- "define": [ "ASYNC" ]
- },
- "frameworkAssemblies": {
- "System.Data": "4.0.0.0",
- "System.Xml": "4.0.0.0",
- "System.Xml.Linq": "4.0.0.0"
- }
- },
- "netstandard1.3": {
- "buildOptions": {
- "define": [ "ASYNC", "COREFX" ]
- },
- "dependencies": {
- "System.Collections": "4.0.11",
- "System.Collections.Concurrent": "4.0.12",
- "System.Collections.NonGeneric": "4.0.1",
- "System.Data.SqlClient": "4.1.0",
- "System.Dynamic.Runtime": "4.0.11",
- "System.Linq": "4.1.0",
- "System.Reflection": "4.1.0",
- "System.Reflection.Emit": "4.0.1",
- "System.Reflection.Emit.Lightweight": "4.0.1",
- "System.Reflection.Extensions": "4.0.1",
- "System.Reflection.TypeExtensions": "4.1.0",
- "System.Runtime": "4.1.0",
- "System.Runtime.Extensions": "4.1.0",
- "System.Runtime.InteropServices": "4.1.0",
- "System.Text.RegularExpressions": "4.1.0",
- "System.Threading": "4.0.11",
- "System.Xml.XDocument": "4.0.11",
- "System.Xml.XmlDocument": "4.0.1"
- }
- }
- }
-}
diff --git a/Dapper.Tests.Contrib/Dapper.Tests.Contrib.csproj b/Dapper.Tests.Contrib/Dapper.Tests.Contrib.csproj
new file mode 100644
index 00000000..2c594a27
--- /dev/null
+++ b/Dapper.Tests.Contrib/Dapper.Tests.Contrib.csproj
@@ -0,0 +1,32 @@
+
+
+ Dapper.Tests.Contrib
+ Dapper.Tests.Contrib
+ Dapper Contrib Test Suite
+ portable
+ Exe
+ false
+ netcoreapp1.0
+
+
+ $(DefineConstants);COREFX;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Dapper.Tests.Contrib/Dapper.Tests.Contrib.xproj b/Dapper.Tests.Contrib/Dapper.Tests.Contrib.xproj
deleted file mode 100644
index 322c83f0..00000000
--- a/Dapper.Tests.Contrib/Dapper.Tests.Contrib.xproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- dab3c5b7-bcd1-4a5f-bb6b-50d2bb63db4a
- Dapper.Tests.Contrib
- .\obj
- .\bin\
-
-
- 2.0
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Dapper.Tests.Contrib/Program.cs b/Dapper.Tests.Contrib/Program.cs
deleted file mode 100644
index 74fd3286..00000000
--- a/Dapper.Tests.Contrib/Program.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Dapper.Tests.Contrib
-{
- public class Program
- {
- static void Main(string[] args)
- {
-
- }
- }
-}
diff --git a/Dapper.Tests.Contrib/Properties/AssemblyInfo.cs b/Dapper.Tests.Contrib/Properties/AssemblyInfo.cs
deleted file mode 100644
index d421e183..00000000
--- a/Dapper.Tests.Contrib/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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.Tests.Contrib")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("Dapper.Tests.Contrib")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
-[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("9d5920b6-d6af-41ca-b851-803ac922d933")]
-
-// 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.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Dapper.Tests.Contrib/TestSuite.Async.cs b/Dapper.Tests.Contrib/TestSuite.Async.cs
index 9be5c726..39f28bf6 100644
--- a/Dapper.Tests.Contrib/TestSuite.Async.cs
+++ b/Dapper.Tests.Contrib/TestSuite.Async.cs
@@ -1,15 +1,10 @@
-#if ASYNC
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
-#if XUNIT2
using FactAttribute = Dapper.Tests.Contrib.SkippableFactAttribute;
-#else
-using Xunit;
-#endif
namespace Dapper.Tests.Contrib
{
@@ -25,34 +20,34 @@ public async Task InsertGetUpdateDeleteWithExplicitKeyAsync()
{
var guid = Guid.NewGuid().ToString();
var o1 = new ObjectX { ObjectXId = guid, Name = "Foo" };
- var originalxCount = (await connection.QueryAsync("Select Count(*) From ObjectX")).First();
- await connection.InsertAsync(o1);
- var list1 = (await connection.QueryAsync("select * from ObjectX")).ToList();
+ var originalxCount = (await connection.QueryAsync("Select Count(*) From ObjectX").ConfigureAwait(false)).First();
+ await connection.InsertAsync(o1).ConfigureAwait(false);
+ var list1 = (await connection.QueryAsync("select * from ObjectX").ConfigureAwait(false)).ToList();
list1.Count.IsEqualTo(originalxCount + 1);
- o1 = await connection.GetAsync(guid);
+ o1 = await connection.GetAsync(guid).ConfigureAwait(false);
o1.ObjectXId.IsEqualTo(guid);
o1.Name = "Bar";
- await connection.UpdateAsync(o1);
- o1 = await connection.GetAsync(guid);
+ await connection.UpdateAsync(o1).ConfigureAwait(false);
+ o1 = await connection.GetAsync(guid).ConfigureAwait(false);
o1.Name.IsEqualTo("Bar");
- await connection.DeleteAsync(o1);
- o1 = await connection.GetAsync(guid);
+ await connection.DeleteAsync(o1).ConfigureAwait(false);
+ o1 = await connection.GetAsync(guid).ConfigureAwait(false);
o1.IsNull();
const int id = 42;
var o2 = new ObjectY { ObjectYId = id, Name = "Foo" };
var originalyCount = connection.Query("Select Count(*) From ObjectY").First();
- await connection.InsertAsync(o2);
- var list2 = (await connection.QueryAsync("select * from ObjectY")).ToList();
+ await connection.InsertAsync(o2).ConfigureAwait(false);
+ var list2 = (await connection.QueryAsync("select * from ObjectY").ConfigureAwait(false)).ToList();
list2.Count.IsEqualTo(originalyCount+1);
- o2 = await connection.GetAsync(id);
+ o2 = await connection.GetAsync(id).ConfigureAwait(false);
o2.ObjectYId.IsEqualTo(id);
o2.Name = "Bar";
- await connection.UpdateAsync(o2);
- o2 = await connection.GetAsync(id);
+ await connection.UpdateAsync(o2).ConfigureAwait(false);
+ o2 = await connection.GetAsync(id).ConfigureAwait(false);
o2.Name.IsEqualTo("Bar");
- await connection.DeleteAsync(o2);
- o2 = await connection.GetAsync(id);
+ await connection.DeleteAsync(o2).ConfigureAwait(false);
+ o2 = await connection.GetAsync(id).ConfigureAwait(false);
o2.IsNull();
}
}
@@ -63,14 +58,14 @@ public async Task TableNameAsync()
using (var connection = GetOpenConnection())
{
// tests against "Automobiles" table (Table attribute)
- var id = await connection.InsertAsync(new Car { Name = "VolvoAsync" });
- var car = await connection.GetAsync(id);
+ var id = await connection.InsertAsync(new Car { Name = "VolvoAsync" }).ConfigureAwait(false);
+ var car = await connection.GetAsync(id).ConfigureAwait(false);
car.IsNotNull();
car.Name.IsEqualTo("VolvoAsync");
- (await connection.UpdateAsync(new Car { Id = id, Name = "SaabAsync" })).IsEqualTo(true);
- (await connection.GetAsync(id)).Name.IsEqualTo("SaabAsync");
- (await connection.DeleteAsync(new Car { Id = id })).IsEqualTo(true);
- (await connection.GetAsync(id)).IsNull();
+ (await connection.UpdateAsync(new Car { Id = id, Name = "SaabAsync" }).ConfigureAwait(false)).IsEqualTo(true);
+ (await connection.GetAsync(id).ConfigureAwait(false)).Name.IsEqualTo("SaabAsync");
+ (await connection.DeleteAsync(new Car { Id = id }).ConfigureAwait(false)).IsEqualTo(true);
+ (await connection.GetAsync(id).ConfigureAwait(false)).IsNull();
}
}
@@ -79,11 +74,11 @@ public async Task TestSimpleGetAsync()
{
using (var connection = GetOpenConnection())
{
- var id = await connection.InsertAsync(new User { Name = "Adama", Age = 10 });
- var user = await connection.GetAsync(id);
+ var id = await connection.InsertAsync(new User { Name = "Adama", Age = 10 }).ConfigureAwait(false);
+ var user = await connection.GetAsync(id).ConfigureAwait(false);
user.Id.IsEqualTo(id);
user.Name.IsEqualTo("Adama");
- await connection.DeleteAsync(user);
+ await connection.DeleteAsync(user).ConfigureAwait(false);
}
}
@@ -92,37 +87,37 @@ public async Task InsertGetUpdateAsync()
{
using (var connection = GetOpenConnection())
{
- (await connection.GetAsync(30)).IsNull();
+ (await connection.GetAsync(30).ConfigureAwait(false)).IsNull();
- var originalCount = (await connection.QueryAsync("select Count(*) from Users")).First();
+ var originalCount = (await connection.QueryAsync("select Count(*) from Users").ConfigureAwait(false)).First();
- var id = await connection.InsertAsync(new User { Name = "Adam", Age = 10 });
+ var id = await connection.InsertAsync(new User { Name = "Adam", Age = 10 }).ConfigureAwait(false);
//get a user with "isdirty" tracking
- var user = await connection.GetAsync(id);
+ var user = await connection.GetAsync(id).ConfigureAwait(false);
user.Name.IsEqualTo("Adam");
- (await connection.UpdateAsync(user)).IsEqualTo(false); //returns false if not updated, based on tracking
+ (await connection.UpdateAsync(user).ConfigureAwait(false)).IsEqualTo(false); //returns false if not updated, based on tracking
user.Name = "Bob";
- (await connection.UpdateAsync(user)).IsEqualTo(true); //returns true if updated, based on tracking
- user = await connection.GetAsync(id);
+ (await connection.UpdateAsync(user).ConfigureAwait(false)).IsEqualTo(true); //returns true if updated, based on tracking
+ user = await connection.GetAsync(id).ConfigureAwait(false);
user.Name.IsEqualTo("Bob");
//get a user with no tracking
- var notrackedUser = await connection.GetAsync(id);
+ var notrackedUser = await connection.GetAsync(id).ConfigureAwait(false);
notrackedUser.Name.IsEqualTo("Bob");
- (await connection.UpdateAsync(notrackedUser)).IsEqualTo(true);
+ (await connection.UpdateAsync(notrackedUser).ConfigureAwait(false)).IsEqualTo(true);
//returns true, even though user was not changed
notrackedUser.Name = "Cecil";
- (await connection.UpdateAsync(notrackedUser)).IsEqualTo(true);
- (await connection.GetAsync(id)).Name.IsEqualTo("Cecil");
+ (await connection.UpdateAsync(notrackedUser).ConfigureAwait(false)).IsEqualTo(true);
+ (await connection.GetAsync(id).ConfigureAwait(false)).Name.IsEqualTo("Cecil");
- (await connection.QueryAsync("select * from Users")).Count().IsEqualTo(originalCount+1);
- (await connection.DeleteAsync(user)).IsEqualTo(true);
- (await connection.QueryAsync("select * from Users")).Count().IsEqualTo(originalCount);
+ (await connection.QueryAsync("select * from Users").ConfigureAwait(false)).Count().IsEqualTo(originalCount+1);
+ (await connection.DeleteAsync(user).ConfigureAwait(false)).IsEqualTo(true);
+ (await connection.QueryAsync("select * from Users").ConfigureAwait(false)).Count().IsEqualTo(originalCount);
- (await connection.UpdateAsync(notrackedUser)).IsEqualTo(false); //returns false, user not found
+ (await connection.UpdateAsync(notrackedUser).ConfigureAwait(false)).IsEqualTo(false); //returns false, user not found
- (await connection.InsertAsync(new User {Name = "Adam", Age = 10})).IsMoreThan(originalCount + 1);
+ (await connection.InsertAsync(new User {Name = "Adam", Age = 10}).ConfigureAwait(false)).IsMoreThan(originalCount + 1);
}
}
@@ -131,11 +126,11 @@ public async Task InsertCheckKeyAsync()
{
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- (await connection.GetAsync(3)).IsNull();
+ (await connection.GetAsync(3).ConfigureAwait(false)).IsNull();
var user = new User { Name = "Adamb", Age = 10 };
- var id = await connection.InsertAsync(user);
+ var id = await connection.InsertAsync(user).ConfigureAwait(false);
user.Id.IsEqualTo(id);
}
}
@@ -145,7 +140,7 @@ public async Task BuilderSelectClauseAsync()
{
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
var rand = new Random(8675309);
var data = new List();
@@ -153,7 +148,7 @@ public async Task BuilderSelectClauseAsync()
{
var nU = new User { Age = rand.Next(70), Id = i, Name = Guid.NewGuid().ToString() };
data.Add(nU);
- nU.Id = await connection.InsertAsync(nU);
+ nU.Id = await connection.InsertAsync(nU).ConfigureAwait(false);
}
var builder = new SqlBuilder();
@@ -162,8 +157,8 @@ public async Task BuilderSelectClauseAsync()
builder.Select("Id");
- var ids = await connection.QueryAsync(justId.RawSql, justId.Parameters);
- var users = await connection.QueryAsync(all.RawSql, all.Parameters);
+ var ids = await connection.QueryAsync(justId.RawSql, justId.Parameters).ConfigureAwait(false);
+ var users = await connection.QueryAsync(all.RawSql, all.Parameters).ConfigureAwait(false);
foreach (var u in data)
{
@@ -185,11 +180,11 @@ public async Task BuilderTemplateWithoutCompositionAsync()
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- await connection.InsertAsync(new User { Age = 5, Name = "Testy McTestington" });
+ await connection.InsertAsync(new User { Age = 5, Name = "Testy McTestington" }).ConfigureAwait(false);
- if ((await connection.QueryAsync(template.RawSql, template.Parameters)).Single() != 1)
+ if ((await connection.QueryAsync(template.RawSql, template.Parameters).ConfigureAwait(false)).Single() != 1)
throw new Exception("Query failed");
}
}
@@ -197,13 +192,13 @@ public async Task BuilderTemplateWithoutCompositionAsync()
[Fact]
public async Task InsertArrayAsync()
{
- await InsertHelperAsync(src => src.ToArray());
+ await InsertHelperAsync(src => src.ToArray()).ConfigureAwait(false);
}
[Fact]
public async Task InsertListAsync()
{
- await InsertHelperAsync(src => src.ToList());
+ await InsertHelperAsync(src => src.ToList()).ConfigureAwait(false);
}
private async Task InsertHelperAsync(Func, T> helper)
@@ -217,9 +212,9 @@ private async Task InsertHelperAsync(Func, T> helper)
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- var total = await connection.InsertAsync(helper(users));
+ var total = await connection.InsertAsync(helper(users)).ConfigureAwait(false);
total.IsEqualTo(numberOfEntities);
users = connection.Query("select * from Users").ToList();
users.Count.IsEqualTo(numberOfEntities);
@@ -229,13 +224,13 @@ private async Task InsertHelperAsync(Func, T> helper)
[Fact]
public async Task UpdateArrayAsync()
{
- await UpdateHelperAsync(src => src.ToArray());
+ await UpdateHelperAsync(src => src.ToArray()).ConfigureAwait(false);
}
[Fact]
public async Task UpdateListAsync()
{
- await UpdateHelperAsync(src => src.ToList());
+ await UpdateHelperAsync(src => src.ToList()).ConfigureAwait(false);
}
private async Task UpdateHelperAsync(Func, T> helper)
@@ -249,17 +244,17 @@ private async Task UpdateHelperAsync(Func, T> helper)
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- var total = await connection.InsertAsync(helper(users));
+ var total = await connection.InsertAsync(helper(users)).ConfigureAwait(false);
total.IsEqualTo(numberOfEntities);
users = connection.Query("select * from Users").ToList();
users.Count.IsEqualTo(numberOfEntities);
foreach (var user in users)
{
- user.Name = user.Name + " updated";
+ user.Name += " updated";
}
- await connection.UpdateAsync(helper(users));
+ await connection.UpdateAsync(helper(users)).ConfigureAwait(false);
var name = connection.Query("select * from Users").First().Name;
name.Contains("updated").IsTrue();
}
@@ -268,13 +263,13 @@ private async Task UpdateHelperAsync(Func, T> helper)
[Fact]
public async Task DeleteArrayAsync()
{
- await DeleteHelperAsync(src => src.ToArray());
+ await DeleteHelperAsync(src => src.ToArray()).ConfigureAwait(false);
}
[Fact]
public async Task DeleteListAsync()
{
- await DeleteHelperAsync(src => src.ToList());
+ await DeleteHelperAsync(src => src.ToList()).ConfigureAwait(false);
}
private async Task DeleteHelperAsync(Func, T> helper)
@@ -288,15 +283,15 @@ private async Task DeleteHelperAsync(Func, T> helper)
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- var total = await connection.InsertAsync(helper(users));
+ var total = await connection.InsertAsync(helper(users)).ConfigureAwait(false);
total.IsEqualTo(numberOfEntities);
users = connection.Query("select * from Users").ToList();
users.Count.IsEqualTo(numberOfEntities);
var usersToDelete = users.Take(10).ToList();
- await connection.DeleteAsync(helper(usersToDelete));
+ await connection.DeleteAsync(helper(usersToDelete)).ConfigureAwait(false);
users = connection.Query("select * from Users").ToList();
users.Count.IsEqualTo(numberOfEntities - 10);
}
@@ -313,13 +308,13 @@ public async Task GetAllAsync()
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- var total = await connection.InsertAsync(users);
+ var total = await connection.InsertAsync(users).ConfigureAwait(false);
total.IsEqualTo(numberOfEntities);
- users = (List)await connection.GetAllAsync();
+ users = (List)await connection.GetAllAsync().ConfigureAwait(false);
users.Count.IsEqualTo(numberOfEntities);
- var iusers = await connection.GetAllAsync();
+ var iusers = await connection.GetAllAsync().ConfigureAwait(false);
iusers.ToList().Count.IsEqualTo(numberOfEntities);
}
}
@@ -329,10 +324,10 @@ public async Task InsertFieldWithReservedNameAsync()
{
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
- var id = await connection.InsertAsync(new Result { Name = "Adam", Order = 1 });
+ await connection.DeleteAllAsync().ConfigureAwait(false);
+ var id = await connection.InsertAsync(new Result { Name = "Adam", Order = 1 }).ConfigureAwait(false);
- var result = await connection.GetAsync(id);
+ var result = await connection.GetAsync(id).ConfigureAwait(false);
result.Order.IsEqualTo(1);
}
}
@@ -342,15 +337,14 @@ public async Task DeleteAllAsync()
{
using (var connection = GetOpenConnection())
{
- await connection.DeleteAllAsync();
+ await connection.DeleteAllAsync().ConfigureAwait(false);
- var id1 = await connection.InsertAsync(new User { Name = "Alice", Age = 32 });
- var id2 = await connection.InsertAsync(new User { Name = "Bob", Age = 33 });
- await connection.DeleteAllAsync();
- (await connection.GetAsync(id1)).IsNull();
- (await connection.GetAsync(id2)).IsNull();
+ var id1 = await connection.InsertAsync(new User { Name = "Alice", Age = 32 }).ConfigureAwait(false);
+ var id2 = await connection.InsertAsync(new User { Name = "Bob", Age = 33 }).ConfigureAwait(false);
+ await connection.DeleteAllAsync().ConfigureAwait(false);
+ (await connection.GetAsync(id1).ConfigureAwait(false)).IsNull();
+ (await connection.GetAsync(id2).ConfigureAwait(false)).IsNull();
}
}
}
-}
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/Dapper.Tests.Contrib/TestSuite.cs b/Dapper.Tests.Contrib/TestSuite.cs
index 02e17918..8cfe2298 100644
--- a/Dapper.Tests.Contrib/TestSuite.cs
+++ b/Dapper.Tests.Contrib/TestSuite.cs
@@ -9,11 +9,7 @@
using System.Data.SqlServerCe;
using System.Transactions;
#endif
-#if XUNIT2
using FactAttribute = Dapper.Tests.Contrib.SkippableFactAttribute;
-#else
-using Xunit;
-#endif
namespace Dapper.Tests.Contrib
{
@@ -32,7 +28,7 @@ public class ObjectY
public int ObjectYId { get; set; }
public string Name { get; set; }
}
-
+
[Table("ObjectZ")]
public class ObjectZ
{
@@ -171,7 +167,7 @@ public void InsertGetUpdateDeleteWithExplicitKey()
o2.IsNull();
}
}
-
+
[Fact]
public void GetAllWithExplicitKey()
{
@@ -187,7 +183,7 @@ public void GetAllWithExplicitKey()
}
}
- [Fact]
+ [Fact]
public void InsertGetUpdateDeleteWithExplicitKeyNamedId()
{
using (var connection = GetOpenConnection())
@@ -208,8 +204,8 @@ public void InsertGetUpdateDeleteWithExplicitKeyNamedId()
//o2.IsNull();
}
}
-
- [Fact]
+
+ [Fact]
public void ShortIdentity()
{
using (var connection = GetOpenConnection())
@@ -233,7 +229,6 @@ public void NullDateTime()
var stuff = connection.Query("select * from Stuff").ToList();
stuff.First().Created.IsNull();
stuff.Last().Created.IsNotNull();
-
}
}
@@ -342,7 +337,7 @@ private void UpdateHelper(Func, T> helper)
users.Count.IsEqualTo(numberOfEntities);
foreach (var user in users)
{
- user.Name = user.Name + " updated";
+ user.Name += " updated";
}
connection.Update(helper(users));
var name = connection.Query("select * from Users").First().Name;
@@ -509,7 +504,6 @@ public void GetAll()
for (var i = 0; i < numberOfEntities; i++)
iusers[i].Age.IsEqualTo(i);
}
-
}
[Fact]
@@ -622,7 +616,6 @@ public void InsertFieldWithReservedName()
var result = connection.Get(id);
result.Order.IsEqualTo(1);
}
-
}
[Fact]
diff --git a/Dapper.Tests.Contrib/TestSuites.cs b/Dapper.Tests.Contrib/TestSuites.cs
index 320d20eb..afee435b 100644
--- a/Dapper.Tests.Contrib/TestSuites.cs
+++ b/Dapper.Tests.Contrib/TestSuites.cs
@@ -19,14 +19,14 @@ namespace Dapper.Tests.Contrib
// the entire set of tests without declarations per method
// If we want to support a new provider, they need only be added here - not in multiple places
-#if XUNIT2
[XunitTestCaseDiscoverer("Dapper.Tests.SkippableFactDiscoverer", "Dapper.Tests.Contrib")]
- public class SkippableFactAttribute : FactAttribute { }
-#endif
+ public class SkippableFactAttribute : FactAttribute
+ {
+ }
public class SqlServerTestSuite : TestSuite
{
- const string DbName = "tempdb";
+ private const string DbName = "tempdb";
public static string ConnectionString =>
IsAppVeyor
? @"Server=(local)\SQL2014;Database=tempdb;User ID=sa;Password=Password12!"
@@ -115,10 +115,8 @@ static MySqlServerTestSuite()
}
}
}
-#endif
-#if !COREFX && !DNX451
- // This doesn't work on DNX right now due to:
+ // This doesn't work on COREFX right now due to:
// In Visual Studio: Interop loads (works from console, though)
// In general: parameter names, see https://github.com/StackExchange/dapper-dot-net/issues/375
public class SQLiteTestSuite : TestSuite
@@ -148,9 +146,7 @@ static SQLiteTestSuite()
}
}
}
-#endif
-#if !COREFX
public class SqlCETestSuite : TestSuite
{
const string FileName = "Test.DB.sdf";
diff --git a/Dapper.Tests.Contrib/project.json b/Dapper.Tests.Contrib/project.json
deleted file mode 100644
index a3e4d046..00000000
--- a/Dapper.Tests.Contrib/project.json
+++ /dev/null
@@ -1,116 +0,0 @@
-{
- "packOptions": {
- "summary": "Dapper Contrib Test Suite",
- "tags": [ "orm", "sql", "micro-orm" ],
- "owners": [ "johandanforth", "marc.gravell", "nick.craver" ],
- "projectUrl": "https://github.com/StackExchange/dapper-dot-net",
- "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/StackExchange/dapper-dot-net"
- }
- },
- "authors": [ "Sam Saffron", "Johan Danforth" ],
- "description": "Dapper Contrib Test Suite",
- "title": "Dapper.Tests.Contrib",
- "version": "1.0.0",
- "copyright": "2017 Stack Exchange, Inc.",
- "dependencies": {
- "Dapper": {
- "target": "project"
- },
- "Dapper.Contrib": {
- "target": "project"
- },
- "Dapper.SqlBuilder": {
- "target": "project"
- },
- "xunit": "2.2.0-beta2-build3300",
- "dotnet-test-xunit": "2.2.0-preview2-build1029"
- },
- "buildOptions": {
- "warningsAsErrors": true,
- "emitEntryPoint": true,
- "debugType": "portable",
- "compile": {
- "include": [
- "**/*.cs"
- ],
- "includeFiles": [
- "../Dapper.Tests/Assert.cs",
- "../Dapper.Tests/XunitSkippable.cs",
- "../Dapper/TypeExtensions.cs"
- ]
- }
- },
- "testRunner": "xunit",
- "frameworks": {
- //"net40": {
- // "frameworkAssemblies": {
- // "System.Configuration": "4.0.0.0",
- // "System.Data": "4.0.0.0",
- // "System.Data.Linq": "4.0.0.0",
- // "System.Transactions": "4.0.0.0",
- // "System.Xml": "4.0.0.0"
- // },
- // "dependencies": {
- // "Microsoft.SqlServer.Compact": "4.0.8876.1",
- // "MySql.Data": "6.9.8",
- // "System.Data.SQLite.Core": "1.0.98.1",
- // "xunit": "1.9.2"
- // }
- //},
- //"net45": {
- // "compilationOptions": {
- // "define": [ "ASYNC", "XUNIT2" ]
- // },
- // "frameworkAssemblies": {
- // "System.Configuration": "4.0.0.0",
- // "System.Data": "4.0.0.0",
- // "System.Data.Linq": "4.0.0.0",
- // "System.Runtime": "4.0.0.0",
- // "System.Transactions": "4.0.0.0",
- // "System.Xml": "4.0.0.0"
- // },
- // "dependencies": {
- // "Microsoft.SqlServer.Compact": "4.0.8876.1",
- // "MySql.Data": "6.9.8",
- // "System.Data.SQLite.Core": "1.0.98.1",
- // "xunit": "2.1.0"
- // }
- //},
- //"net451": {
- // "buildOptions": {
- // "define": [ "ASYNC", "XUNIT2" ]
- // },
- // "frameworkAssemblies": {
- // "System.Configuration": "4.0.0.0",
- // "System.Data.Linq": "4.0.0.0",
- // "System.Transactions": "4.0.0.0"
- // },
- // "dependencies": {
- // "Microsoft.SqlServer.Compact": "4.0.8876.1",
- // "MySql.Data": "6.9.8",
- // "System.Data.SQLite.Core": "1.0.98.1",
- // "xunit": "2.1.0",
- // "dotnet-test-xunit": "1.0.0-rc3-*"
- // }
- //},
- "netcoreapp1.0": {
- "imports": [
- "portable-net451+win8",
- "dnxcore50"
- ],
- "buildOptions": {
- "define": [ "COREFX", "ASYNC", "XUNIT2" ]
- },
- "dependencies": {
- "Microsoft.NETCore.App": {
- "version": "1.0.0",
- "type": "platform"
- },
- "Microsoft.Data.Sqlite": "1.0.0"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj b/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj
new file mode 100644
index 00000000..c1da1927
--- /dev/null
+++ b/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj
@@ -0,0 +1,41 @@
+
+
+ Dapper.Tests.Performance
+ Dapper.Tests.Performance
+ Dapper Core Performance Suite
+ Exe
+ false
+ net462
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Dapper.Tests/EntityFramework/EFContext.cs b/Dapper.Tests.Performance/EntityFramework/EFContext.cs
similarity index 56%
rename from Dapper.Tests/EntityFramework/EFContext.cs
rename to Dapper.Tests.Performance/EntityFramework/EFContext.cs
index 31791e09..0316dd56 100644
--- a/Dapper.Tests/EntityFramework/EFContext.cs
+++ b/Dapper.Tests.Performance/EntityFramework/EFContext.cs
@@ -1,13 +1,14 @@
-#if ENTITY_FRAMEWORK
-using System.Data.Common;
+using System.Data.Common;
using System.Data.Entity;
-namespace Dapper.Tests.EntityFramework
+namespace Dapper.Tests.Performance.EntityFramework
{
public class EFContext : DbContext
{
- public EFContext(DbConnection connection, bool owned = false) : base(connection, owned) { }
+ public EFContext(DbConnection connection, bool owned = false) : base(connection, owned)
+ {
+ }
+
public DbSet Posts { get;set; }
}
}
-#endif
diff --git a/Dapper.Tests/Linq2Sql/DataClasses.dbml b/Dapper.Tests.Performance/Linq2Sql/DataClasses.dbml
similarity index 85%
rename from Dapper.Tests/Linq2Sql/DataClasses.dbml
rename to Dapper.Tests.Performance/Linq2Sql/DataClasses.dbml
index a6ae1ce2..01e3f6fe 100644
--- a/Dapper.Tests/Linq2Sql/DataClasses.dbml
+++ b/Dapper.Tests.Performance/Linq2Sql/DataClasses.dbml
@@ -1,5 +1,4 @@
-
diff --git a/Dapper.Tests/Linq2Sql/DataClasses.dbml.layout b/Dapper.Tests.Performance/Linq2Sql/DataClasses.dbml.layout
similarity index 100%
rename from Dapper.Tests/Linq2Sql/DataClasses.dbml.layout
rename to Dapper.Tests.Performance/Linq2Sql/DataClasses.dbml.layout
diff --git a/Dapper.Tests/Linq2Sql/DataClasses.designer.cs b/Dapper.Tests.Performance/Linq2Sql/DataClasses.designer.cs
similarity index 94%
rename from Dapper.Tests/Linq2Sql/DataClasses.designer.cs
rename to Dapper.Tests.Performance/Linq2Sql/DataClasses.designer.cs
index 6c488b06..0f1ca005 100644
--- a/Dapper.Tests/Linq2Sql/DataClasses.designer.cs
+++ b/Dapper.Tests.Performance/Linq2Sql/DataClasses.designer.cs
@@ -10,7 +10,7 @@
//
//------------------------------------------------------------------------------
-namespace Dapper.Tests.Linq2Sql
+namespace Dapper.Tests.Performance.Linq2Sql
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
@@ -36,12 +36,6 @@ public partial class DataClassesDataContext : System.Data.Linq.DataContext
partial void DeletePost(Post instance);
#endregion
- public DataClassesDataContext() :
- base(global::Dapper.Tests.Properties.Settings.Default.tempdbConnectionString, mappingSource)
- {
- OnCreated();
- }
-
public DataClassesDataContext(string connection) :
base(connection, mappingSource)
{
diff --git a/Dapper.Tests/Massive/Massive.cs b/Dapper.Tests.Performance/Massive/Massive.cs
similarity index 100%
rename from Dapper.Tests/Massive/Massive.cs
rename to Dapper.Tests.Performance/Massive/Massive.cs
diff --git a/Dapper.Tests/NHibernate/NHibernateHelper.cs b/Dapper.Tests.Performance/NHibernate/NHibernateHelper.cs
similarity index 67%
rename from Dapper.Tests/NHibernate/NHibernateHelper.cs
rename to Dapper.Tests.Performance/NHibernate/NHibernateHelper.cs
index 2896ede4..9c349211 100644
--- a/Dapper.Tests/NHibernate/NHibernateHelper.cs
+++ b/Dapper.Tests.Performance/NHibernate/NHibernateHelper.cs
@@ -1,10 +1,9 @@
-#if NHIBERNATE
-using NHibernate;
+using NHibernate;
using NHibernate.Cfg;
-namespace Dapper.Tests.NHibernate
+namespace Dapper.Tests.Performance.NHibernate
{
- public class NHibernateHelper
+ public static class NHibernateHelper
{
private static ISessionFactory _sessionFactory;
@@ -15,9 +14,9 @@ private static ISessionFactory SessionFactory
if (_sessionFactory == null)
{
var configuration = new Configuration();
- configuration.Configure(@"..\Dapper.Tests\NHibernate\hibernate.cfg.xml");
+ configuration.Configure(@".\NHibernate\hibernate.cfg.xml");
configuration.AddAssembly(typeof(Post).Assembly);
- configuration.AddXmlFile(@"..\Dapper.Tests\NHibernate\Post.hbm.xml");
+ configuration.AddXmlFile(@".\NHibernate\Post.hbm.xml");
_sessionFactory = configuration.BuildSessionFactory();
}
@@ -30,5 +29,4 @@ public static IStatelessSession OpenSession()
return SessionFactory.OpenStatelessSession();
}
}
-}
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/Dapper.Tests/NHibernate/Post.hbm.xml b/Dapper.Tests.Performance/NHibernate/Post.hbm.xml
similarity index 87%
rename from Dapper.Tests/NHibernate/Post.hbm.xml
rename to Dapper.Tests.Performance/NHibernate/Post.hbm.xml
index 963a1df9..58591255 100644
--- a/Dapper.Tests/NHibernate/Post.hbm.xml
+++ b/Dapper.Tests.Performance/NHibernate/Post.hbm.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/Dapper.Tests/NHibernate/hibernate.cfg.xml b/Dapper.Tests.Performance/NHibernate/hibernate.cfg.xml
similarity index 69%
rename from Dapper.Tests/NHibernate/hibernate.cfg.xml
rename to Dapper.Tests.Performance/NHibernate/hibernate.cfg.xml
index 8ec1f107..49212ff6 100644
--- a/Dapper.Tests/NHibernate/hibernate.cfg.xml
+++ b/Dapper.Tests.Performance/NHibernate/hibernate.cfg.xml
@@ -4,8 +4,7 @@
NHibernate.Connection.DriverConnectionProvider
NHibernate.Dialect.MsSql2005Dialect
NHibernate.Driver.SqlClientDriver
- Smackdown.Properties.Settings.tempdbConnectionString
- NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
+ Main
false
diff --git a/Dapper.Tests/PerformanceTests.cs b/Dapper.Tests.Performance/PerformanceTests.cs
similarity index 60%
rename from Dapper.Tests/PerformanceTests.cs
rename to Dapper.Tests.Performance/PerformanceTests.cs
index 3c1bb76c..6d8fb7a0 100644
--- a/Dapper.Tests/PerformanceTests.cs
+++ b/Dapper.Tests.Performance/PerformanceTests.cs
@@ -1,74 +1,67 @@
using System;
using System.Collections.Generic;
using System.Data;
+using System.Data.Linq;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
-using Dapper.Tests.Linq2Sql;
+//using BLToolkit.Data; // Note: this doesn't load in the new .csproj system...likely a bug
+using Dapper.Tests.Performance.EntityFramework;
+using Dapper.Tests.Performance.Linq2Sql;
+using Dapper.Tests.Performance.NHibernate;
using Dapper.Contrib.Extensions;
-
-
-#if SOMA
-using Soma.Core;
-#endif
-#if NHIBERNATE
+using Massive;
using NHibernate.Criterion;
using NHibernate.Linq;
-using Dapper.Tests.NHibernate;
-#endif
-#if LINQ2SQL
-using System.Data.Linq;
-#endif
-#if MASSIVE
-using Massive;
-#endif
-#if ORMLITE
using ServiceStack.OrmLite;
-using ServiceStack.OrmLite.SqlServer;
-using ServiceStack.OrmLite.Converters;
using ServiceStack.OrmLite.Dapper;
-#endif
-#if BLTOOLKIT
-using BLToolkit.Data;
-#endif
-#if ENTITY_FRAMEWORK
-using Dapper.Tests.EntityFramework;
-#endif
-#if SUSANOO
using Susanoo;
-#endif
-
+using System.Configuration;
+using System.Threading.Tasks;
-namespace Dapper.Tests
+namespace Dapper.Tests.Performance
{
- public class PerformanceTests
+ public partial class PerformanceTests
{
- class Test
+ private class Test
{
- public static Test Create(Action iteration, string name)
+ public Test(Action iteration, string name)
{
- return new Test {Iteration = iteration, Name = name };
+ Iteration = iteration;
+ Name = name;
+ }
+
+ public Test(Func iterationAsync, string name)
+ {
+ IterationAsync = iterationAsync;
+ Name = name;
}
public Action Iteration { get; set; }
+ public Func IterationAsync { get; set; }
public string Name { get; set; }
public Stopwatch Watch { get; set; }
}
- class Tests : List
+ private class Tests : List
{
public void Add(Action iteration, string name)
{
- Add(Test.Create(iteration, name));
+ Add(new Test(iteration, name));
+ }
+ public void AddAsync(Func iterationAsync, string name)
+ {
+ Add(new Test(iterationAsync, name));
}
- public void Run(int iterations)
- {
+ public async Task RunAsync(int iterations)
+ {
// warmup
foreach (var test in this)
{
- test.Iteration(iterations + 1);
+ test.Iteration?.Invoke(iterations + 1);
+ if (test.IterationAsync != null) await test.IterationAsync(iterations + 1).ConfigureAwait(false);
test.Watch = new Stopwatch();
test.Watch.Reset();
}
@@ -79,7 +72,8 @@ public void Run(int iterations)
foreach (var test in this.OrderBy(ignore => rand.Next()))
{
test.Watch.Start();
- test.Iteration(i);
+ test.Iteration?.Invoke(i);
+ if (test.IterationAsync != null) await test.IterationAsync(i).ConfigureAwait(false);
test.Watch.Stop();
}
}
@@ -90,181 +84,153 @@ public void Run(int iterations)
}
}
}
-#if LINQ2SQL
- static DataClassesDataContext GetL2SContext(SqlConnection connection)
+
+ public static string ConnectionString { get; } = ConfigurationManager.ConnectionStrings["Main"].ConnectionString;
+
+ public static SqlConnection GetOpenConnection()
{
- return new DataClassesDataContext(connection);
+ var connection = new SqlConnection(ConnectionString);
+ connection.Open();
+ return connection;
}
-#endif
-
-#if SOMA
- internal class SomaConfig : Soma.Core.MsSqlConfig
- {
- public override string ConnectionString => TestSuite.ConnectionString;
+ private static DataClassesDataContext GetL2SContext(SqlConnection connection) =>
+ new DataClassesDataContext(connection);
- public override Action Logger
- {
- get { return noOp; }
- }
- static readonly Action noOp = x => { };
- }
-#endif
- static void Try(Action action, string blame)
+ private static void Try(Action action, string blame)
{
try
{
action();
- } catch(Exception ex)
+ }
+ catch (Exception ex)
{
Console.Error.WriteLine($"{blame}: {ex.Message}");
}
}
- public void Run(int iterations)
+
+ public async Task RunAsync(int iterations)
{
- using (var connection = TestSuite.GetOpenConnection())
+ using (var connection = GetOpenConnection())
{
var tests = new Tests();
-#if LINQ2SQL
+
+ // Linq2SQL
Try(() =>
{
var l2scontext1 = GetL2SContext(connection);
- tests.Add(id => l2scontext1.Posts.First(p => p.Id == id), "Linq 2 SQL");
+ tests.Add(id => l2scontext1.Posts.First(p => p.Id == id), "Linq2Sql: Normal");
var l2scontext2 = GetL2SContext(connection);
var compiledGetPost = CompiledQuery.Compile((Linq2Sql.DataClassesDataContext ctx, int id) => ctx.Posts.First(p => p.Id == id));
- tests.Add(id => compiledGetPost(l2scontext2, id), "Linq 2 SQL Compiled");
+ tests.Add(id => compiledGetPost(l2scontext2, id), "Linq2Sql: Compiled");
var l2scontext3 = GetL2SContext(connection);
- tests.Add(id => l2scontext3.ExecuteQuery("select * from Posts where Id = {0}", id).First(), "Linq 2 SQL ExecuteQuery");
+ tests.Add(id => l2scontext3.ExecuteQuery("select * from Posts where Id = {0}", id).First(), "Linq2Sql: ExecuteQuery");
}, "LINQ-to-SQL");
-#endif
-#if ENTITY_FRAMEWORK
+ // Entity Framework
Try(() =>
{
var entityContext = new EFContext(connection);
- tests.Add(id => entityContext.Posts.First(p => p.Id == id), "Entity framework");
-
+ tests.Add(id => entityContext.Posts.First(p => p.Id == id), "Entity Framework");
var entityContext2 = new EFContext(connection);
- tests.Add(id => entityContext2.Database.SqlQuery("select * from Posts where Id = {0}", id).First(), "Entity framework SqlQuery");
+ tests.Add(id => entityContext2.Database.SqlQuery("select * from Posts where Id = {0}", id).First(), "Entity Framework: SqlQuery");
//var entityContext3 = new EFContext(connection);
- //tests.Add(id => entityFrameworkCompiled(entityContext3, id), "Entity framework CompiledQuery");
+ //tests.Add(id => entityFrameworkCompiled(entityContext3, id), "Entity Framework CompiledQuery");
//var entityContext4 = new EFContext(connection);
- //tests.Add(id => entityContext4.Posts.Where("it.Id = @id", new System.Data.Objects.ObjectParameter("id", id)).First(), "Entity framework ESQL");
+ //tests.Add(id => entityContext4.Posts.Where("it.Id = @id", new System.Data.Objects.ObjectParameter("id", id)).First(), "Entity Framework ESQL");
var entityContext5 = new EFContext(connection);
- tests.Add(id => entityContext5.Posts.AsNoTracking().First(p => p.Id == id), "Entity framework No Tracking");
+ tests.Add(id => entityContext5.Posts.AsNoTracking().First(p => p.Id == id), "Entity Framework: No Tracking");
}, "Entity Framework");
-#endif
+
+ // Dapper
Try(() =>
{
- var mapperConnection = TestSuite.GetOpenConnection();
- tests.Add(id => mapperConnection.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: true).First(), "Mapper Query (buffered)");
- tests.Add(id => mapperConnection.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: false).First(), "Mapper Query (non-buffered)");
- tests.Add(id => mapperConnection.QueryFirstOrDefault("select * from Posts where Id = @Id", new { Id = id }), "Mapper QueryFirstOrDefault");
+ var mapperConnection = GetOpenConnection();
+ tests.Add(id => mapperConnection.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: true).First(), "Dapper: Query (buffered)");
+ tests.Add(id => mapperConnection.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: false).First(), "Dapper: Query (non-buffered)");
+ tests.Add(id => mapperConnection.QueryFirstOrDefault("select * from Posts where Id = @Id", new { Id = id }), "Dapper: QueryFirstOrDefault");
- var mapperConnection2 = TestSuite.GetOpenConnection();
- tests.Add(id => mapperConnection2.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: true).First(), "Dynamic Mapper Query (buffered)");
- tests.Add(id => mapperConnection2.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: false).First(), "Dynamic Mapper Query (non-buffered)");
- tests.Add(id => mapperConnection2.QueryFirstOrDefault("select * from Posts where Id = @Id", new { Id = id }), "Dynamic Mapper QueryQueryFirstOrDefault");
+ var mapperConnection2 = GetOpenConnection();
+ tests.Add(id => mapperConnection2.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: true).First(), "Dapper: Dynamic Query (buffered)");
+ tests.Add(id => mapperConnection2.Query("select * from Posts where Id = @Id", new { Id = id }, buffered: false).First(), "Dapper: Dynamic Query (non-buffered)");
+ tests.Add(id => mapperConnection2.QueryFirstOrDefault("select * from Posts where Id = @Id", new { Id = id }), "Dapper: Dynamic QueryFirstOrDefault");
// dapper.contrib
- var mapperConnection3 = TestSuite.GetOpenConnection();
+ var mapperConnection3 = GetOpenConnection();
tests.Add(id => mapperConnection3.Get(id), "Dapper.Contrib");
}, "Dapper");
-#if MASSIVE
+ // Massive
Try(() =>
{
- // massive
- var massiveModel = new DynamicModel(TestSuite.ConnectionString);
- var massiveConnection = TestSuite.GetOpenConnection();
- tests.Add(id => massiveModel.Query("select * from Posts where Id = @0", massiveConnection, id).First(), "Dynamic Massive ORM Query");
+ var massiveModel = new DynamicModel(ConnectionString);
+ var massiveConnection = GetOpenConnection();
+ tests.Add(id => massiveModel.Query("select * from Posts where Id = @0", massiveConnection, id).First(), "Massive: Dynamic ORM Query");
}, "Massive");
-#endif
-#if PETAPOCO
+ // PetaPoco
Try(() =>
{
// PetaPoco test with all default options
- var petapoco = new PetaPoco.Database(TestSuite.ConnectionString, "System.Data.SqlClient");
+ var petapoco = new PetaPoco.Database(ConnectionString, "System.Data.SqlClient");
petapoco.OpenSharedConnection();
- tests.Add(id => petapoco.Fetch("SELECT * from Posts where Id=@0", id).First(), "PetaPoco (Normal)");
+ tests.Add(id => petapoco.Fetch("SELECT * from Posts where Id=@0", id).First(), "PetaPoco: Normal");
// PetaPoco with some "smart" functionality disabled
- var petapocoFast = new PetaPoco.Database(TestSuite.ConnectionString, "System.Data.SqlClient");
+ var petapocoFast = new PetaPoco.Database(ConnectionString, "System.Data.SqlClient");
petapocoFast.OpenSharedConnection();
petapocoFast.EnableAutoSelect = false;
petapocoFast.EnableNamedParams = false;
petapocoFast.ForceDateTimesToUtc = false;
- tests.Add(id => petapocoFast.Fetch("SELECT * from Posts where Id=@0", id).First(), "PetaPoco (Fast)");
+ tests.Add(id => petapocoFast.Fetch("SELECT * from Posts where Id=@0", id).First(), "PetaPoco: Fast");
}, "PetaPoco");
-#endif
-
-#if SUBSONIC
- Try(() =>
- {
- // Subsonic ActiveRecord
- tests.Add(id => SubSonic.Post.SingleOrDefault(x => x.Id == id), "SubSonic ActiveRecord.SingleOrDefault");
- // Subsonic coding horror
- SubSonic.tempdbDB db = new SubSonic.tempdbDB();
- tests.Add(id => new SubSonic.Query.CodingHorror(db.Provider, "select * from Posts where Id = @0", id).ExecuteTypedList(), "SubSonic Coding Horror");
- }, "Subsonic");
-#endif
// NHibernate
-
-#if NHIBERNATE
- Try(() => {
+ Try(() =>
+ {
var nhSession1 = NHibernateHelper.OpenSession();
tests.Add(id => nhSession1.CreateSQLQuery(@"select * from Posts where Id = :id")
.SetInt32("id", id)
- .List(), "NHibernate SQL");
+ .List(), "NHibernate: SQL");
var nhSession2 = NHibernateHelper.OpenSession();
tests.Add(id => nhSession2.CreateQuery(@"from Post as p where p.Id = :id")
.SetInt32("id", id)
- .List(), "NHibernate HQL");
+ .List(), "NHibernate: HQL");
var nhSession3 = NHibernateHelper.OpenSession();
tests.Add(id => nhSession3.CreateCriteria()
.Add(Restrictions.IdEq(id))
- .List(), "NHibernate Criteria");
+ .List(), "NHibernate: Criteria");
var nhSession4 = NHibernateHelper.OpenSession();
tests.Add(id => nhSession4
.Query()
- .First(p => p.Id == id), "NHibernate LINQ");
+ .First(p => p.Id == id), "NHibernate: LINQ");
var nhSession5 = NHibernateHelper.OpenSession();
- tests.Add(id => nhSession5.Get(id), "NHibernate Session.Get");
+ tests.Add(id => nhSession5.Get(id), "NHibernate: Session.Get");
}, "NHibernate");
-#endif
-#if BLTOOLKIT
- // bltoolkit
- var db1 = new DbManager(TestSuite.GetOpenConnection());
- tests.Add(id => db1.SetCommand("select * from Posts where Id = @id", db1.Parameter("id", id)).ExecuteList(), "BLToolkit");
-#endif
-#if SIMPLEDATA
+
// Simple.Data
Try(() =>
{
- var sdb = Simple.Data.Database.OpenConnection(TestSuite.ConnectionString);
+ var sdb = Simple.Data.Database.OpenConnection(ConnectionString);
tests.Add(id => sdb.Posts.FindById(id).FirstOrDefault(), "Simple.Data");
}, "Simple.Data");
-#endif
-
-#if BELGRADE
+ // Belgrade
Try(() =>
{
- var query = new Belgrade.SqlClient.SqlDb.QueryMapper(TestSuite.GetOpenConnection());
- tests.Add(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id,
+ var query = new Belgrade.SqlClient.SqlDb.QueryMapper(ConnectionString);
+ tests.AddAsync(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id,
reader =>
{
var post = new Post();
@@ -285,67 +251,51 @@ public void Run(int iterations)
}), "Belgrade Sql Client");
}, "Belgrade Sql Client");
-#endif
-
-#if SUSANOO
//Susanoo
- var susanooDb = new DatabaseManager("Smackdown.Properties.Settings.tempdbConnectionString");
- var susanooDb2 = new DatabaseManager("Smackdown.Properties.Settings.tempdbConnectionString");
-
+ var susanooDb = new DatabaseManager(connection);
var susanooPreDefinedCommand =
- CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
+ CommandManager.Instance.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults()
- .Realize("PostById");
+ .Realize();
var susanooDynamicPreDefinedCommand =
- CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
+ CommandManager.Instance.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults()
- .Realize("DynamicById");
+ .Realize();
tests.Add(Id =>
- CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
+ CommandManager.Instance.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults()
- .Realize("PostById")
- .Execute(susanooDb, new { Id }).First(), "Susanoo Mapping Cache Retrieval");
+ .Realize()
+ .Execute(susanooDb, new { Id }).First(), "Susanoo: Mapping Cache Retrieval");
tests.Add(Id =>
- CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
+ CommandManager.Instance.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults()
- .Realize("DynamicById")
- .Execute(susanooDb, new { Id }).First(), "Susanoo Dynamic Mapping Cache Retrieval");
+ .Realize()
+ .Execute(susanooDb, new { Id }).First(), "Susanoo: Dynamic Mapping Cache Retrieval");
- tests.Add(Id =>
- susanooDynamicPreDefinedCommand
- .Execute(susanooDb, new { Id }).First(), "Susanoo Dynamic Mapping Static");
-
- tests.Add(Id =>
- susanooPreDefinedCommand
- .Execute(susanooDb, new { Id }).First(), "Susanoo Mapping Static");
-#endif
+ tests.Add(Id => susanooDynamicPreDefinedCommand
+ .Execute(susanooDb, new { Id }).First(), "Susanoo: Dynamic Mapping Static");
-#if SOMA
- // Soma
+ tests.Add(Id => susanooPreDefinedCommand
+ .Execute(susanooDb, new { Id }).First(), "Susanoo: Mapping Static");
- // DISABLED: assembly fail loading FSharp.PowerPack, Version=2.0.0.0
- // var somadb = new Soma.Core.Db(new SomaConfig());
- // tests.Add(id => somadb.Find(id), "Soma");
-#endif
-#if ORMLITE
//ServiceStack's OrmLite:
-
- // DISABLED: can't find QueryById
- //OrmLiteConfig.DialectProvider = SqlServerOrmLiteDialectProvider.Instance; //Using SQL Server
- //IDbCommand ormLiteCmd = TestSuite.GetOpenConnection().CreateCommand();
- // tests.Add(id => ormLiteCmd.QueryById(id), "OrmLite QueryById");
-#endif
- // HAND CODED
-
+ Try(() =>
+ {
+ var dbFactory = new OrmLiteConnectionFactory(ConnectionString, SqlServerDialect.Provider);
+ var db = dbFactory.Open();
+ tests.Add(id => db.SingleById(id), "ServiceStack.OrmLite: SingleById");
+ }, "ServiceStack.OrmLite");
+
+ // Hand Coded
var postCommand = new SqlCommand();
postCommand.Connection = connection;
postCommand.CommandText = @"select Id, [Text], [CreationDate], LastChangeDate,
Counter1,Counter2,Counter3,Counter4,Counter5,Counter6,Counter7,Counter8,Counter9 from Posts where Id = @Id";
- var idParam = postCommand.Parameters.Add("@Id", System.Data.SqlDbType.Int);
+ var idParam = postCommand.Parameters.Add("@Id", SqlDbType.Int);
tests.Add(id =>
{
@@ -370,10 +320,26 @@ public void Run(int iterations)
post.Counter8 = reader.GetNullableValue(11);
post.Counter9 = reader.GetNullableValue(12);
}
- }, "hand coded");
+ }, "Hand Coded");
+
+ // Subsonic isn't maintained anymore - doesn't import correctly
+ //Try(() =>
+ // {
+ // // Subsonic ActiveRecord
+ // tests.Add(id => 3SubSonic.Post.SingleOrDefault(x => x.Id == id), "SubSonic ActiveRecord.SingleOrDefault");
+
+ // // Subsonic coding horror
+ // SubSonic.tempdbDB db = new SubSonic.tempdbDB();
+ // tests.Add(id => new SubSonic.Query.CodingHorror(db.Provider, "select * from Posts where Id = @0", id).ExecuteTypedList(), "SubSonic Coding Horror");
+ //}, "Subsonic");
+
+ //// BLToolkit - doesn't import correctly in the new .csproj world
+ //var db1 = new DbManager(GetOpenConnection());
+ //tests.Add(id => db1.SetCommand("select * from Posts where Id = @id", db1.Parameter("id", id)).ExecuteList(), "BLToolkit");
+
#if !COREFX
- DataTable table = new DataTable
+ var table = new DataTable
{
Columns =
{
@@ -406,32 +372,8 @@ public void Run(int iterations)
#endif
Console.WriteLine();
Console.WriteLine("Running...");
- tests.Run(iterations);
- }
- }
-
- }
-
- static class SqlDataReaderHelper
- {
- public static string GetNullableString(this SqlDataReader reader, int index)
- {
- object tmp = reader.GetValue(index);
- if (tmp != DBNull.Value)
- {
- return (string)tmp;
- }
- return null;
- }
-
- public static Nullable GetNullableValue(this SqlDataReader reader, int index) where T : struct
- {
- object tmp = reader.GetValue(index);
- if (tmp != DBNull.Value)
- {
- return (T)tmp;
+ await tests.RunAsync(iterations).ConfigureAwait(false);
}
- return null;
}
}
}
\ No newline at end of file
diff --git a/Dapper.Tests/PetaPoco/PetaPoco.cs b/Dapper.Tests.Performance/PetaPoco/PetaPoco.cs
similarity index 96%
rename from Dapper.Tests/PetaPoco/PetaPoco.cs
rename to Dapper.Tests.Performance/PetaPoco/PetaPoco.cs
index 1d8a5b63..2b7e8b14 100644
--- a/Dapper.Tests/PetaPoco/PetaPoco.cs
+++ b/Dapper.Tests.Performance/PetaPoco/PetaPoco.cs
@@ -714,7 +714,7 @@ public static bool SplitSqlForPaging(string sql, out string sqlCount, out string
public T Single(string sql, params object[] args) where T : new()
{
T val = SingleOrDefault(sql, args);
- if (val != null)
+ if (!EqualityComparer.Default.Equals(val, default(T)))
return val;
else
throw new InvalidOperationException("The sequence contains no elements");
@@ -722,7 +722,7 @@ public static bool SplitSqlForPaging(string sql, out string sqlCount, out string
public T First(string sql, params object[] args) where T : new()
{
T val = FirstOrDefault(sql, args);
- if (val != null)
+ if (!EqualityComparer.Default.Equals(val, default(T)))
return val;
else
throw new InvalidOperationException("The sequence contains no elements");
diff --git a/Dapper.Tests.Performance/Post.cs b/Dapper.Tests.Performance/Post.cs
new file mode 100644
index 00000000..78c71ccd
--- /dev/null
+++ b/Dapper.Tests.Performance/Post.cs
@@ -0,0 +1,25 @@
+using System;
+using Soma.Core;
+
+namespace Dapper.Tests.Performance
+{
+ [ServiceStack.DataAnnotations.Alias("Posts")]
+ [Table(Name = "Posts")]
+ public class Post
+ {
+ [Id(IdKind.Identity)]
+ public int Id { get; set; }
+ public string Text { get; set; }
+ public DateTime CreationDate { get; set; }
+ public DateTime LastChangeDate { get; set; }
+ public int? Counter1 { get; set; }
+ public int? Counter2 { get; set; }
+ public int? Counter3 { get; set; }
+ public int? Counter4 { get; set; }
+ public int? Counter5 { get; set; }
+ public int? Counter6 { get; set; }
+ public int? Counter7 { get; set; }
+ public int? Counter8 { get; set; }
+ public int? Counter9 { get; set; }
+ }
+}
diff --git a/Dapper.Tests/Program.cs b/Dapper.Tests.Performance/Program.cs
similarity index 54%
rename from Dapper.Tests/Program.cs
rename to Dapper.Tests.Performance/Program.cs
index de780908..56d96749 100644
--- a/Dapper.Tests/Program.cs
+++ b/Dapper.Tests.Performance/Program.cs
@@ -1,54 +1,31 @@
using System;
+using System.Threading.Tasks;
-namespace Dapper.Tests
+namespace Dapper.Tests.Performance
{
-#if ORMLITE
- [ServiceStack.DataAnnotations.Alias("Posts")]
-#endif
-#if SOMA
- [Soma.Core.Table(Name = "Posts")]
-#endif
- public class Post
- {
-#if SOMA
- [Soma.Core.Id(Soma.Core.IdKind.Identity)]
-#endif
- public int Id { get; set; }
- public string Text { get; set; }
- public DateTime CreationDate { get; set; }
- public DateTime LastChangeDate { get; set; }
- public int? Counter1 { get; set; }
- public int? Counter2 { get; set; }
- public int? Counter3 { get; set; }
- public int? Counter4 { get; set; }
- public int? Counter5 { get; set; }
- public int? Counter6 { get; set; }
- public int? Counter7 { get; set; }
- public int? Counter8 { get; set; }
- public int? Counter9 { get; set; }
- }
-
- class Program
+ // Note: VSTest injects an entry point in .NET Core land...so we have to split this out into
+ // a separate project...so here we are.
+ // See https://github.com/Microsoft/vstest/issues/636 for details
+ public static class Program
{
- static void Main()
+ public static void Main()
{
#if DEBUG
var fg = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Warning: DEBUG configuration; performance may be impacted");
-#if DNX
- Console.WriteLine("use: dnx --configuration release perf");
-#endif
Console.ForegroundColor = fg;
Console.WriteLine();
#endif
+ Console.WriteLine("Using ConnectionString: " + PerformanceTests.ConnectionString);
+
EnsureDBSetup();
- RunPerformanceTests();
+ RunPerformanceTestsAsync().GetAwaiter().GetResult();
}
private static void EnsureDBSetup()
{
- using (var cnn = TestSuite.GetOpenConnection())
+ using (var cnn = PerformanceTests.GetOpenConnection())
{
var cmd = cnn.CreateCommand();
cmd.CommandText = @"
@@ -95,12 +72,12 @@ insert Posts ([Text],CreationDate, LastChangeDate) values (replicate('x', 2000),
}
}
- static void RunPerformanceTests()
+ private static async Task RunPerformanceTestsAsync()
{
var test = new PerformanceTests();
const int iterations = 500;
Console.WriteLine("Running {0} iterations that load up a post entity", iterations);
- test.Run(iterations);
+ await test.RunAsync(iterations).ConfigureAwait(false);
}
}
}
diff --git a/Dapper.Tests.Performance/Soma/SomaConfig.cs b/Dapper.Tests.Performance/Soma/SomaConfig.cs
new file mode 100644
index 00000000..0716e98d
--- /dev/null
+++ b/Dapper.Tests.Performance/Soma/SomaConfig.cs
@@ -0,0 +1,14 @@
+using Soma.Core;
+using System;
+
+namespace Dapper.Tests.Performance.Soma
+{
+ internal class SomaConfig : MsSqlConfig
+ {
+ public override string ConnectionString => PerformanceTests.ConnectionString;
+
+ public override Action Logger => noOp;
+
+ private static readonly Action noOp = x => { };
+ }
+}
diff --git a/Dapper.Tests.Performance/SqlDataReaderHelper.cs b/Dapper.Tests.Performance/SqlDataReaderHelper.cs
new file mode 100644
index 00000000..a7137582
--- /dev/null
+++ b/Dapper.Tests.Performance/SqlDataReaderHelper.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Data.SqlClient;
+
+namespace Dapper.Tests.Performance
+{
+ public static class SqlDataReaderHelper
+ {
+ public static string GetNullableString(this SqlDataReader reader, int index)
+ {
+ object tmp = reader.GetValue(index);
+ if (tmp != DBNull.Value)
+ {
+ return (string)tmp;
+ }
+ return null;
+ }
+
+ public static T? GetNullableValue(this SqlDataReader reader, int index) where T : struct
+ {
+ object tmp = reader.GetValue(index);
+ if (tmp != DBNull.Value)
+ {
+ return (T)tmp;
+ }
+ return null;
+ }
+ }
+}
diff --git a/Dapper.Tests.Performance/app.config b/Dapper.Tests.Performance/app.config
new file mode 100644
index 00000000..5ea174a5
--- /dev/null
+++ b/Dapper.Tests.Performance/app.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dapper.Tests/Tests.Async.cs b/Dapper.Tests/AsyncTests.cs
similarity index 83%
rename from Dapper.Tests/Tests.Async.cs
rename to Dapper.Tests/AsyncTests.cs
index 4b0fd364..f67d2424 100644
--- a/Dapper.Tests/Tests.Async.cs
+++ b/Dapper.Tests/AsyncTests.cs
@@ -1,5 +1,4 @@
-#if ASYNC
-using System.Linq;
+using System.Linq;
using System.Data;
using System.Diagnostics;
using System;
@@ -10,12 +9,15 @@
namespace Dapper.Tests
{
- public partial class TestSuite
+ public class Tests : TestBase
{
+ private SqlConnection _marsConnection;
+ private SqlConnection marsConnection => _marsConnection ?? (_marsConnection = GetOpenConnection(true));
+
[Fact]
public async Task TestBasicStringUsageAsync()
{
- var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" });
+ var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" }).ConfigureAwait(false);
var arr = query.ToArray();
arr.IsSequenceEqualTo(new[] { "abc", "def" });
}
@@ -23,35 +25,35 @@ public async Task TestBasicStringUsageAsync()
[Fact]
public async Task TestBasicStringUsageQueryFirstAsync()
{
- var str = await connection.QueryFirstAsync(new CommandDefinition("select 'abc' as [Value] union all select @txt", new {txt = "def"}));
+ var str = await connection.QueryFirstAsync(new CommandDefinition("select 'abc' as [Value] union all select @txt", new {txt = "def"})).ConfigureAwait(false);
str.IsEqualTo("abc");
}
[Fact]
public async Task TestBasicStringUsageQueryFirstOrDefaultAsync()
{
- var str = await connection.QueryFirstOrDefaultAsync(new CommandDefinition("select null as [Value] union all select @txt", new {txt = "def"}));
+ var str = await connection.QueryFirstOrDefaultAsync(new CommandDefinition("select null as [Value] union all select @txt", new {txt = "def"})).ConfigureAwait(false);
str.IsNull();
}
[Fact]
public async Task TestBasicStringUsageQuerySingleAsync()
{
- var str = await connection.QuerySingleAsync(new CommandDefinition("select 'abc' as [Value]"));
+ var str = await connection.QuerySingleAsync(new CommandDefinition("select 'abc' as [Value]")).ConfigureAwait(false);
str.IsEqualTo("abc");
}
[Fact]
public async Task TestBasicStringUsageQuerySingleOrDefaultAsync()
{
- var str = await connection.QuerySingleAsync(new CommandDefinition("select null as [Value]"));
+ var str = await connection.QuerySingleAsync(new CommandDefinition("select null as [Value]")).ConfigureAwait(false);
str.IsNull();
}
[Fact]
public async Task TestBasicStringUsageAsyncNonBuffered()
{
- var query = await connection.QueryAsync(new CommandDefinition("select 'abc' as [Value] union all select @txt", new { txt = "def" }, flags: CommandFlags.None));
+ var query = await connection.QueryAsync(new CommandDefinition("select 'abc' as [Value] union all select @txt", new { txt = "def" }, flags: CommandFlags.None)).ConfigureAwait(false);
var arr = query.ToArray();
arr.IsSequenceEqualTo(new[] { "abc", "def" });
}
@@ -77,7 +79,7 @@ public void TestLongOperationWithCancellation()
[Fact]
public async Task TestBasicStringUsageClosedAsync()
{
- var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" });
+ var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" }).ConfigureAwait(false);
var arr = query.ToArray();
arr.IsSequenceEqualTo(new[] { "abc", "def" });
}
@@ -85,7 +87,7 @@ public async Task TestBasicStringUsageClosedAsync()
[Fact]
public async Task TestQueryDynamicAsync()
{
- var row = (await connection.QueryAsync("select 'abc' as [Value]")).Single();
+ var row = (await connection.QueryAsync("select 'abc' as [Value]").ConfigureAwait(false)).Single();
string value = row.Value;
value.IsEqualTo("abc");
}
@@ -93,7 +95,7 @@ public async Task TestQueryDynamicAsync()
[Fact]
public async Task TestClassWithStringUsageAsync()
{
- var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" });
+ var query = await connection.QueryAsync("select 'abc' as [Value] union all select @txt", new { txt = "def" }).ConfigureAwait(false);
var arr = query.ToArray();
arr.Select(x => x.Value).IsSequenceEqualTo(new[] { "abc", "def" });
}
@@ -101,7 +103,7 @@ public async Task TestClassWithStringUsageAsync()
[Fact]
public async Task TestExecuteAsync()
{
- var val = await connection.ExecuteAsync("declare @foo table(id int not null); insert @foo values(@id);", new { id = 1 });
+ var val = await connection.ExecuteAsync("declare @foo table(id int not null); insert @foo values(@id);", new { id = 1 }).ConfigureAwait(false);
val.Equals(1);
}
@@ -121,7 +123,7 @@ public async Task TestMultiMapWithSplitAsync()
{
prod.Category = cat;
return prod;
- });
+ }).ConfigureAwait(false);
var product = productQuery.First();
// assertions
@@ -139,7 +141,7 @@ public async Task TestMultiMapArbitraryWithSplitAsync()
var prod = (Product)objects[0];
prod.Category = (Category)objects[1];
return prod;
- });
+ }).ConfigureAwait(false);
var product = productQuery.First();
// assertions
@@ -152,14 +154,14 @@ public async Task TestMultiMapArbitraryWithSplitAsync()
[Fact]
public async Task TestMultiMapWithSplitClosedConnAsync()
{
- var sql = @"select 1 as id, 'abc' as name, 2 as id, 'def' as name";
+ const string sql = @"select 1 as id, 'abc' as name, 2 as id, 'def' as name";
using (var conn = GetClosedConnection())
{
var productQuery = await conn.QueryAsync(sql, (prod, cat) =>
{
prod.Category = cat;
return prod;
- });
+ }).ConfigureAwait(false);
var product = productQuery.First();
// assertions
@@ -173,7 +175,7 @@ public async Task TestMultiMapWithSplitClosedConnAsync()
[Fact]
public async Task TestMultiAsync()
{
- using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2"))
+ using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2").ConfigureAwait(false))
{
multi.ReadAsync().Result.Single().IsEqualTo(1);
multi.ReadAsync().Result.Single().IsEqualTo(2);
@@ -183,7 +185,7 @@ public async Task TestMultiAsync()
[Fact]
public async Task TestMultiAsyncViaFirstOrDefault()
{
- using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2; select 3; select 4; select 5"))
+ using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2; select 3; select 4; select 5").ConfigureAwait(false))
{
multi.ReadFirstOrDefaultAsync().Result.IsEqualTo(1);
multi.ReadAsync().Result.Single().IsEqualTo(2);
@@ -196,7 +198,7 @@ public async Task TestMultiAsyncViaFirstOrDefault()
[Fact]
public async Task TestMultiClosedConnAsync()
{
- using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2"))
+ using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2").ConfigureAwait(false))
{
multi.ReadAsync().Result.Single().IsEqualTo(1);
multi.ReadAsync().Result.Single().IsEqualTo(2);
@@ -206,7 +208,7 @@ public async Task TestMultiClosedConnAsync()
[Fact]
public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
{
- using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2; select 3; select 4; select 5;"))
+ using (SqlMapper.GridReader multi = await connection.QueryMultipleAsync("select 1; select 2; select 3; select 4; select 5;").ConfigureAwait(false))
{
multi.ReadFirstOrDefaultAsync().Result.IsEqualTo(1);
multi.ReadAsync().Result.Single().IsEqualTo(2);
@@ -221,7 +223,7 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
public async Task ExecuteReaderOpenAsync()
{
var dt = new DataTable();
- dt.Load(await connection.ExecuteReaderAsync("select 3 as [three], 4 as [four]"));
+ dt.Load(await connection.ExecuteReaderAsync("select 3 as [three], 4 as [four]").ConfigureAwait(false));
dt.Columns.Count.IsEqualTo(2);
dt.Columns[0].ColumnName.IsEqualTo("three");
dt.Columns[1].ColumnName.IsEqualTo("four");
@@ -229,14 +231,14 @@ public async Task ExecuteReaderOpenAsync()
((int)dt.Rows[0][0]).IsEqualTo(3);
((int)dt.Rows[0][1]).IsEqualTo(4);
}
-
+
[Fact]
public async Task ExecuteReaderClosedAsync()
{
using (var conn = GetClosedConnection())
{
var dt = new DataTable();
- dt.Load(await conn.ExecuteReaderAsync("select 3 as [three], 4 as [four]"));
+ dt.Load(await conn.ExecuteReaderAsync("select 3 as [three], 4 as [four]").ConfigureAwait(false));
dt.Columns.Count.IsEqualTo(2);
dt.Columns[0].ColumnName.IsEqualTo("three");
dt.Columns[1].ColumnName.IsEqualTo("four");
@@ -250,64 +252,70 @@ public async Task ExecuteReaderClosedAsync()
[Fact]
public async Task LiteralReplacementOpen()
{
- await LiteralReplacement(connection);
+ await LiteralReplacement(connection).ConfigureAwait(false);
}
+
[Fact]
public async Task LiteralReplacementClosed()
{
- using (var conn = GetClosedConnection()) await LiteralReplacement(conn);
+ using (var conn = GetClosedConnection()) await LiteralReplacement(conn).ConfigureAwait(false);
}
+
private async Task LiteralReplacement(IDbConnection conn)
{
try
{
- await conn.ExecuteAsync("drop table literal1");
- } catch { }
- await conn.ExecuteAsync("create table literal1 (id int not null, foo int not null)");
- await conn.ExecuteAsync("insert literal1 (id,foo) values ({=id}, @foo)", new { id = 123, foo = 456 });
+ await conn.ExecuteAsync("drop table literal1").ConfigureAwait(false);
+ }
+ catch { /* don't care */ }
+ await conn.ExecuteAsync("create table literal1 (id int not null, foo int not null)").ConfigureAwait(false);
+ await conn.ExecuteAsync("insert literal1 (id,foo) values ({=id}, @foo)", new { id = 123, foo = 456 }).ConfigureAwait(false);
var rows = new[] { new { id = 1, foo = 2 }, new { id = 3, foo = 4 } };
- await conn.ExecuteAsync("insert literal1 (id,foo) values ({=id}, @foo)", rows);
- var count = (await conn.QueryAsync("select count(1) from literal1 where id={=foo}", new { foo = 123 })).Single();
+ await conn.ExecuteAsync("insert literal1 (id,foo) values ({=id}, @foo)", rows).ConfigureAwait(false);
+ var count = (await conn.QueryAsync