Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
a4bb66de
Commit
a4bb66de
authored
Feb 11, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test cleanup; enable lots more tests hidden previously as EXTERNALS
parent
19afe1ed
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
294 additions
and
146 deletions
+294
-146
EFContext.cs
Dapper.Tests/EntityFramework/EFContext.cs
+1
-1
NHibernateHelper.cs
Dapper.Tests/NHibernate/NHibernateHelper.cs
+1
-1
PerformanceTests.cs
Dapper.Tests/PerformanceTests.cs
+158
-95
Program.cs
Dapper.Tests/Program.cs
+5
-3
Tests.Async.cs
Dapper.Tests/Tests.Async.cs
+1
-1
Tests.Constructors.cs
Dapper.Tests/Tests.Constructors.cs
+1
-1
Tests.Parameters.cs
Dapper.Tests/Tests.Parameters.cs
+13
-5
Tests.cs
Dapper.Tests/Tests.cs
+28
-13
project.json
Dapper.Tests/project.json
+86
-26
No files found.
Dapper.Tests/EntityFramework/EFContext.cs
View file @
a4bb66de
#
if
E
XTERNALS
#
if
E
NTITY_FRAMEWORK
using
System.Data.Common
;
using
System.Data.Common
;
using
System.Data.Entity
;
using
System.Data.Entity
;
...
...
Dapper.Tests/NHibernate/NHibernateHelper.cs
View file @
a4bb66de
#
if
EXTERNALS
#
if
NHIBERNATE
using
NHibernate
;
using
NHibernate
;
using
NHibernate.Cfg
;
using
NHibernate.Cfg
;
...
...
Dapper.Tests/PerformanceTests.cs
View file @
a4bb66de
...
@@ -9,20 +9,34 @@
...
@@ -9,20 +9,34 @@
using
Dapper.Contrib.Extensions
;
using
Dapper.Contrib.Extensions
;
#if
EXTERNALS
#if
SOMA
using
Soma.Core
;
using
Soma.Core
;
#endif
#if NHIBERNATE
using
NHibernate.Criterion
;
using
NHibernate.Linq
;
using
Dapper.Tests.NHibernate
;
using
Dapper.Tests.NHibernate
;
#endif
#if LINQ2SQL
using
System.Data.Linq
;
using
System.Data.Linq
;
#endif
#if MASSIVE
using
Massive
;
using
Massive
;
using
NHibernate.Criterion
;
#endif
using
NHibernate.Linq
;
#if ORMLITE
using
ServiceStack.OrmLite
;
using
ServiceStack.OrmLite
;
using
ServiceStack.OrmLite.SqlServer
;
using
ServiceStack.OrmLite.SqlServer
;
using
ServiceStack.OrmLite.Converters
;
using
ServiceStack.OrmLite.Dapper
;
#endif
#if BLTOOLKIT
using
BLToolkit.Data
;
using
BLToolkit.Data
;
#endif
#if ENTITY_FRAMEWORK
using
Dapper.Tests.EntityFramework
;
using
Dapper.Tests.EntityFramework
;
#endif
#if SUSANOO
using
Susanoo
;
using
Susanoo
;
using
ServiceStack.OrmLite.Converters
;
using
ServiceStack.OrmLite.Dapper
;
#endif
#endif
...
@@ -76,12 +90,14 @@ public void Run(int iterations)
...
@@ -76,12 +90,14 @@ public void Run(int iterations)
}
}
}
}
}
}
#if
EXTERNALS
#if
LINQ2SQL
static
DataClassesDataContext
GetL2SContext
(
SqlConnection
connection
)
static
DataClassesDataContext
GetL2SContext
(
SqlConnection
connection
)
{
{
return
new
DataClassesDataContext
(
connection
);
return
new
DataClassesDataContext
(
connection
);
}
}
#endif
#if SOMA
internal
class
SomaConfig
:
Soma
.
Core
.
MsSqlConfig
internal
class
SomaConfig
:
Soma
.
Core
.
MsSqlConfig
{
{
...
@@ -94,13 +110,24 @@ public override Action<PreparedStatement> Logger
...
@@ -94,13 +110,24 @@ public override Action<PreparedStatement> Logger
static
readonly
Action
<
PreparedStatement
>
noOp
=
x
=>
{
};
static
readonly
Action
<
PreparedStatement
>
noOp
=
x
=>
{
};
}
}
#endif
#endif
static
void
Try
(
Action
action
,
string
blame
)
{
try
{
action
();
}
catch
(
Exception
ex
)
{
Console
.
Error
.
WriteLine
(
$"
{
blame
}
:
{
ex
.
Message
}
"
);
}
}
public
void
Run
(
int
iterations
)
public
void
Run
(
int
iterations
)
{
{
using
(
var
connection
=
TestSuite
.
GetOpenConnection
())
using
(
var
connection
=
TestSuite
.
GetOpenConnection
())
{
{
var
tests
=
new
Tests
();
var
tests
=
new
Tests
();
#if EXTERNALS
#if LINQ2SQL
Try
(()
=>
{
var
l2scontext1
=
GetL2SContext
(
connection
);
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
),
"Linq 2 SQL"
);
...
@@ -110,7 +137,12 @@ public void Run(int iterations)
...
@@ -110,7 +137,12 @@ public void Run(int iterations)
var
l2scontext3
=
GetL2SContext
(
connection
);
var
l2scontext3
=
GetL2SContext
(
connection
);
tests
.
Add
(
id
=>
l2scontext3
.
ExecuteQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
First
(),
"Linq 2 SQL ExecuteQuery"
);
tests
.
Add
(
id
=>
l2scontext3
.
ExecuteQuery
<
Post
>(
"select * from Posts where Id = {0}"
,
id
).
First
(),
"Linq 2 SQL ExecuteQuery"
);
},
"LINQ-to-SQL"
);
#endif
#if ENTITY_FRAMEWORK
Try
(()
=>
{
var
entityContext
=
new
EFContext
(
connection
);
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"
);
...
@@ -126,7 +158,10 @@ public void Run(int iterations)
...
@@ -126,7 +158,10 @@ public void Run(int iterations)
var
entityContext5
=
new
EFContext
(
connection
);
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
#endif
Try
(()
=>
{
var
mapperConnection
=
TestSuite
.
GetOpenConnection
();
var
mapperConnection
=
TestSuite
.
GetOpenConnection
();
tests
.
Add
(
id
=>
mapperConnection
.
Query
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
},
buffered
:
true
).
First
(),
"Mapper Query (buffered)"
);
tests
.
Add
(
id
=>
mapperConnection
.
Query
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
},
buffered
:
true
).
First
(),
"Mapper Query (buffered)"
);
tests
.
Add
(
id
=>
mapperConnection
.
Query
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
},
buffered
:
false
).
First
(),
"Mapper Query (non-buffered)"
);
tests
.
Add
(
id
=>
mapperConnection
.
Query
<
Post
>(
"select * from Posts where Id = @Id"
,
new
{
Id
=
id
},
buffered
:
false
).
First
(),
"Mapper Query (non-buffered)"
);
...
@@ -140,14 +175,22 @@ public void Run(int iterations)
...
@@ -140,14 +175,22 @@ public void Run(int iterations)
// dapper.contrib
// dapper.contrib
var
mapperConnection3
=
TestSuite
.
GetOpenConnection
();
var
mapperConnection3
=
TestSuite
.
GetOpenConnection
();
tests
.
Add
(
id
=>
mapperConnection3
.
Get
<
Post
>(
id
),
"Dapper.Cotrib"
);
tests
.
Add
(
id
=>
mapperConnection3
.
Get
<
Post
>(
id
),
"Dapper.Contrib"
);
},
"Dapper"
);
#if EXTERNALS
#if MASSIVE
Try
(()
=>
{
// massive
// massive
var
massiveModel
=
new
DynamicModel
(
TestSuite
.
ConnectionString
);
var
massiveModel
=
new
DynamicModel
(
TestSuite
.
ConnectionString
);
var
massiveConnection
=
TestSuite
.
GetOpenConnection
();
var
massiveConnection
=
TestSuite
.
GetOpenConnection
();
tests
.
Add
(
id
=>
massiveModel
.
Query
(
"select * from Posts where Id = @0"
,
massiveConnection
,
id
).
First
(),
"Dynamic Massive ORM Query"
);
tests
.
Add
(
id
=>
massiveModel
.
Query
(
"select * from Posts where Id = @0"
,
massiveConnection
,
id
).
First
(),
"Dynamic Massive ORM Query"
);
},
"Massive"
);
#endif
#if PETAPOCO
Try
(()
=>
{
// PetaPoco test with all default options
// PetaPoco test with all default options
var
petapoco
=
new
PetaPoco
.
Database
(
TestSuite
.
ConnectionString
,
"System.Data.SqlClient"
);
var
petapoco
=
new
PetaPoco
.
Database
(
TestSuite
.
ConnectionString
,
"System.Data.SqlClient"
);
petapoco
.
OpenSharedConnection
();
petapoco
.
OpenSharedConnection
();
...
@@ -160,18 +203,24 @@ public void Run(int iterations)
...
@@ -160,18 +203,24 @@ public void Run(int iterations)
petapocoFast
.
EnableNamedParams
=
false
;
petapocoFast
.
EnableNamedParams
=
false
;
petapocoFast
.
ForceDateTimesToUtc
=
false
;
petapocoFast
.
ForceDateTimesToUtc
=
false
;
tests
.
Add
(
id
=>
petapocoFast
.
Fetch
<
Post
>(
"SELECT * from Posts where Id=@0"
,
id
).
First
(),
"PetaPoco (Fast)"
);
tests
.
Add
(
id
=>
petapocoFast
.
Fetch
<
Post
>(
"SELECT * from Posts where Id=@0"
,
id
).
First
(),
"PetaPoco (Fast)"
);
},
"PetaPoco"
);
#endif
#if SUBSONIC
#if SUBSONIC
Try
(()
=>
{
// Subsonic ActiveRecord
// Subsonic ActiveRecord
tests
.
Add
(
id
=>
SubSonic
.
Post
.
SingleOrDefault
(
x
=>
x
.
Id
==
id
),
"SubSonic ActiveRecord.SingleOrDefault"
);
tests
.
Add
(
id
=>
SubSonic
.
Post
.
SingleOrDefault
(
x
=>
x
.
Id
==
id
),
"SubSonic ActiveRecord.SingleOrDefault"
);
// Subsonic coding horror
// Subsonic coding horror
SubSonic
.
tempdbDB
db
=
new
SubSonic
.
tempdbDB
();
SubSonic
.
tempdbDB
db
=
new
SubSonic
.
tempdbDB
();
tests
.
Add
(
id
=>
new
SubSonic
.
Query
.
CodingHorror
(
db
.
Provider
,
"select * from Posts where Id = @0"
,
id
).
ExecuteTypedList
<
Post
>(),
"SubSonic Coding Horror"
);
tests
.
Add
(
id
=>
new
SubSonic
.
Query
.
CodingHorror
(
db
.
Provider
,
"select * from Posts where Id = @0"
,
id
).
ExecuteTypedList
<
Post
>(),
"SubSonic Coding Horror"
);
},
"Subsonic"
);
#endif
#endif
// NHibernate
// NHibernate
#if NHIBERNATE
#if NHIBERNATE
Try
(()
=>
{
var
nhSession1
=
NHibernateHelper
.
OpenSession
();
var
nhSession1
=
NHibernateHelper
.
OpenSession
();
tests
.
Add
(
id
=>
nhSession1
.
CreateSQLQuery
(
@"select * from Posts where Id = :id"
)
tests
.
Add
(
id
=>
nhSession1
.
CreateSQLQuery
(
@"select * from Posts where Id = :id"
)
.
SetInt32
(
"id"
,
id
)
.
SetInt32
(
"id"
,
id
)
...
@@ -194,20 +243,28 @@ public void Run(int iterations)
...
@@ -194,20 +243,28 @@ public void Run(int iterations)
var
nhSession5
=
NHibernateHelper
.
OpenSession
();
var
nhSession5
=
NHibernateHelper
.
OpenSession
();
tests
.
Add
(
id
=>
nhSession5
.
Get
<
Post
>(
id
),
"NHibernate Session.Get"
);
tests
.
Add
(
id
=>
nhSession5
.
Get
<
Post
>(
id
),
"NHibernate Session.Get"
);
},
"NHibernate"
);
#endif
#endif
#if BLTOOLKIT
// bltoolkit
// bltoolkit
var
db1
=
new
DbManager
(
TestSuite
.
GetOpenConnection
());
var
db1
=
new
DbManager
(
TestSuite
.
GetOpenConnection
());
tests
.
Add
(
id
=>
db1
.
SetCommand
(
"select * from Posts where Id = @id"
,
db1
.
Parameter
(
"id"
,
id
)).
ExecuteList
<
Post
>(),
"BLToolkit"
);
tests
.
Add
(
id
=>
db1
.
SetCommand
(
"select * from Posts where Id = @id"
,
db1
.
Parameter
(
"id"
,
id
)).
ExecuteList
<
Post
>(),
"BLToolkit"
);
#endif
#if SIMPLEDATA
#if SIMPLEDATA
// Simple.Data
// Simple.Data
Try
(()
=>
{
var
sdb
=
Simple
.
Data
.
Database
.
OpenConnection
(
TestSuite
.
ConnectionString
);
var
sdb
=
Simple
.
Data
.
Database
.
OpenConnection
(
TestSuite
.
ConnectionString
);
tests
.
Add
(
id
=>
sdb
.
Posts
.
FindById
(
id
),
"Simple.Data"
);
tests
.
Add
(
id
=>
sdb
.
Posts
.
FindById
(
id
),
"Simple.Data"
);
},
"Simple.Data"
);
#endif
#endif
#if SUSANOO
//Susanoo
//Susanoo
var
susanooDb
=
new
DatabaseManager
(
"Smackdown.Properties.Settings.tempdbConnectionString"
);
var
susanooDb
=
new
DatabaseManager
(
"Smackdown.Properties.Settings.tempdbConnectionString"
);
var
susanooDb2
=
new
DatabaseManager
(
"Smackdown.Properties.Settings.tempdbConnectionString"
);
var
susanooDb2
=
new
DatabaseManager
(
"Smackdown.Properties.Settings.tempdbConnectionString"
);
var
susanooPreDefinedCommand
=
var
susanooPreDefinedCommand
=
CommandManager
.
DefineCommand
(
"SELECT * FROM Posts WHERE Id = @Id"
,
CommandType
.
Text
)
CommandManager
.
DefineCommand
(
"SELECT * FROM Posts WHERE Id = @Id"
,
CommandType
.
Text
)
.
DefineResults
<
Post
>()
.
DefineResults
<
Post
>()
...
@@ -237,19 +294,23 @@ public void Run(int iterations)
...
@@ -237,19 +294,23 @@ public void Run(int iterations)
tests
.
Add
(
Id
=>
tests
.
Add
(
Id
=>
susanooPreDefinedCommand
susanooPreDefinedCommand
.
Execute
(
susanooDb
,
new
{
Id
}).
First
(),
"Susanoo Mapping Static"
);
.
Execute
(
susanooDb
,
new
{
Id
}).
First
(),
"Susanoo Mapping Static"
);
#endif
#if SOMA
// Soma
// Soma
// DISABLED: assembly fail loading FSharp.PowerPack, Version=2.0.0.0
// DISABLED: assembly fail loading FSharp.PowerPack, Version=2.0.0.0
// var somadb = new Soma.Core.Db(new SomaConfig());
// var somadb = new Soma.Core.Db(new SomaConfig());
// tests.Add(id => somadb.Find<Post>(id), "Soma");
// tests.Add(id => somadb.Find<Post>(id), "Soma");
#endif
#if ORMLITE
#if ORMLITE
//ServiceStack's OrmLite:
//ServiceStack's OrmLite:
OrmLiteConfig
.
DialectProvider
=
SqlServerOrmLiteDialectProvider
.
Instance
;
//Using SQL Server
IDbCommand
ormLiteCmd
=
TestSuite
.
GetOpenConnection
().
CreateCommand
();
// DISABLED: can't find QueryById
tests
.
Add
(
id
=>
ormLiteCmd
.
QueryById
<
Post
>(
id
),
"OrmLite QueryById"
);
//OrmLiteConfig.DialectProvider = SqlServerOrmLiteDialectProvider.Instance; //Using SQL Server
//IDbCommand ormLiteCmd = TestSuite.GetOpenConnection().CreateCommand();
// tests.Add(id => ormLiteCmd.QueryById<Post>(id), "OrmLite QueryById");
#endif
#endif
#endif // EXTERNALS
// HAND CODED
// HAND CODED
var
postCommand
=
new
SqlCommand
();
var
postCommand
=
new
SqlCommand
();
...
@@ -315,6 +376,8 @@ public void Run(int iterations)
...
@@ -315,6 +376,8 @@ public void Run(int iterations)
}
}
},
"DataTable via IDataReader.GetValues"
);
},
"DataTable via IDataReader.GetValues"
);
#endif
#endif
Console
.
WriteLine
();
Console
.
WriteLine
(
"Running..."
);
tests
.
Run
(
iterations
);
tests
.
Run
(
iterations
);
}
}
}
}
...
...
Dapper.Tests/Program.cs
View file @
a4bb66de
...
@@ -2,13 +2,15 @@
...
@@ -2,13 +2,15 @@
namespace
Dapper.Tests
namespace
Dapper.Tests
{
{
#if
EXTERNALS
#if
ORMLITE
[
ServiceStack
.
DataAnnotations
.
Alias
(
"Posts"
)]
[
ServiceStack
.
DataAnnotations
.
Alias
(
"Posts"
)]
#endif
#if SOMA
[
Soma
.
Core
.
Table
(
Name
=
"Posts"
)]
[
Soma
.
Core
.
Table
(
Name
=
"Posts"
)]
#endif
#endif
public
class
Post
public
class
Post
{
{
#if
EXTERNALS
#if
SOMA
[
Soma
.
Core
.
Id
(
Soma
.
Core
.
IdKind
.
Identity
)]
[
Soma
.
Core
.
Id
(
Soma
.
Core
.
IdKind
.
Identity
)]
#endif
#endif
public
int
Id
{
get
;
set
;
}
public
int
Id
{
get
;
set
;
}
...
...
Dapper.Tests/Tests.Async.cs
View file @
a4bb66de
...
@@ -192,7 +192,7 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
...
@@ -192,7 +192,7 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
}
}
}
}
#if
EXTERNALS
#if
!COREFX
[
Fact
]
[
Fact
]
public
async
Task
ExecuteReaderOpenAsync
()
public
async
Task
ExecuteReaderOpenAsync
()
{
{
...
...
Dapper.Tests/Tests.Constructors.cs
View file @
a4bb66de
...
@@ -114,7 +114,7 @@ public bool GetWentThroughProperConstructor()
...
@@ -114,7 +114,7 @@ public bool GetWentThroughProperConstructor()
}
}
}
}
#if
EXTERNALS
#if
LINQ2SQL
class
NoDefaultConstructorWithBinary
class
NoDefaultConstructorWithBinary
{
{
public
System
.
Data
.
Linq
.
Binary
Value
{
get
;
set
;
}
public
System
.
Data
.
Linq
.
Binary
Value
{
get
;
set
;
}
...
...
Dapper.Tests/Tests.Parameters.cs
View file @
a4bb66de
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
using
System.Linq
;
using
System.Linq
;
using
Xunit
;
using
Xunit
;
#if E
XTERNALS
#if E
NTITY_FRAMEWORK
using
System.Data.Entity.Spatial
;
using
System.Data.Entity.Spatial
;
using
Microsoft.SqlServer.Types
;
using
Microsoft.SqlServer.Types
;
#endif
#endif
...
@@ -114,7 +114,7 @@ public void AddParameter(IDbCommand command, string name)
...
@@ -114,7 +114,7 @@ public void AddParameter(IDbCommand command, string name)
}
}
#if
EXTERNALS
#if
!COREFX
[
Fact
]
[
Fact
]
public
void
TestTVPWithAnonymousObject
()
public
void
TestTVPWithAnonymousObject
()
{
{
...
@@ -346,7 +346,9 @@ public void DataTableParametersWithExtendedProperty()
...
@@ -346,7 +346,9 @@ public void DataTableParametersWithExtendedProperty()
ex
.
Message
.
Equals
(
"The table type parameter 'ids' must have a valid type name."
);
ex
.
Message
.
Equals
(
"The table type parameter 'ids' must have a valid type name."
);
}
}
}
}
#endif
#if !COREFX
[
Fact
]
[
Fact
]
public
void
SupportInit
()
public
void
SupportInit
()
{
{
...
@@ -354,7 +356,9 @@ public void SupportInit()
...
@@ -354,7 +356,9 @@ public void SupportInit()
obj
.
Value
.
Equals
(
"abc"
);
obj
.
Value
.
Equals
(
"abc"
);
obj
.
Flags
.
Equals
(
31
);
obj
.
Flags
.
Equals
(
31
);
}
}
#endif
#if ENTITY_FRAMEWORK
class
HazGeo
class
HazGeo
{
{
public
int
Id
{
get
;
set
;
}
public
int
Id
{
get
;
set
;
}
...
@@ -445,6 +449,10 @@ public class HazSqlHierarchy
...
@@ -445,6 +449,10 @@ public class HazSqlHierarchy
public
SqlHierarchyId
Path
{
get
;
set
;
}
public
SqlHierarchyId
Path
{
get
;
set
;
}
}
}
#endif
#if OLEDB
// see http://stackoverflow.com/q/18847510/23354
// see http://stackoverflow.com/q/18847510/23354
[
Fact
]
[
Fact
]
public
void
TestOleDbParameters
()
public
void
TestOleDbParameters
()
...
...
Dapper.Tests/Tests.cs
View file @
a4bb66de
...
@@ -26,16 +26,20 @@
...
@@ -26,16 +26,20 @@
using
System.Diagnostics
;
using
System.Diagnostics
;
using
Xunit
;
using
Xunit
;
using
System.Data.Common
;
using
System.Data.Common
;
#if
EXTERNALS
#if
FIREBIRD
using
FirebirdSql.Data.FirebirdClient
;
using
FirebirdSql.Data.FirebirdClient
;
#endif
#if ENTITY_FRAMEWORK
using
System.Data.Entity.Spatial
;
using
System.Data.Entity.Spatial
;
using
Microsoft.SqlServer.Types
;
using
Microsoft.SqlServer.Types
;
#endif
#if SQL_CE
using
System.Data.SqlServerCe
;
using
System.Data.SqlServerCe
;
#endif
using
SqlServerTypes
;
using
SqlServerTypes
;
#if POSTGRESQL
#if POSTGRESQL
using
Npgsql
;
using
Npgsql
;
#endif
#endif
#endif
#if COREFX
#if COREFX
namespace
System.ComponentModel
{
namespace
System.ComponentModel
{
...
@@ -116,10 +120,16 @@ static TestSuite()
...
@@ -116,10 +120,16 @@ static TestSuite()
#endif
#endif
Console
.
WriteLine
(
"Dapper: "
+
typeof
(
SqlMapper
).
AssemblyQualifiedName
);
Console
.
WriteLine
(
"Dapper: "
+
typeof
(
SqlMapper
).
AssemblyQualifiedName
);
Console
.
WriteLine
(
"Using Connectionstring: {0}"
,
ConnectionString
);
Console
.
WriteLine
(
"Using Connectionstring: {0}"
,
ConnectionString
);
#if
EXTERNALS && !DN
X
#if
!COREF
X
Console
.
Write
(
"Loading native assemblies for SQL types..."
);
Console
.
Write
(
"Loading native assemblies for SQL types..."
);
try
{
Utilities
.
LoadNativeAssemblies
(
AppDomain
.
CurrentDomain
.
BaseDirectory
);
Utilities
.
LoadNativeAssemblies
(
AppDomain
.
CurrentDomain
.
BaseDirectory
);
Console
.
WriteLine
(
"done."
);
Console
.
WriteLine
(
"done."
);
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"failed."
);
Console
.
Error
.
WriteLine
(
ex
.
Message
);
}
#endif
#endif
}
}
...
@@ -726,7 +736,7 @@ public void TestInheritance()
...
@@ -726,7 +736,7 @@ public void TestInheritance()
list
.
First
().
Base2
.
IsEqualTo
(
"Four"
);
list
.
First
().
Base2
.
IsEqualTo
(
"Four"
);
}
}
#if
EXTERNALS
#if
!COREFX
[
Fact
]
[
Fact
]
public
void
ExecuteReader
()
public
void
ExecuteReader
()
{
{
...
@@ -739,7 +749,9 @@ public void ExecuteReader()
...
@@ -739,7 +749,9 @@ public void ExecuteReader()
((
int
)
dt
.
Rows
[
0
][
0
]).
IsEqualTo
(
3
);
((
int
)
dt
.
Rows
[
0
][
0
]).
IsEqualTo
(
3
);
((
int
)
dt
.
Rows
[
0
][
1
]).
IsEqualTo
(
4
);
((
int
)
dt
.
Rows
[
0
][
1
]).
IsEqualTo
(
4
);
}
}
#endif
#if SQL_CE
[
Fact
]
[
Fact
]
public
void
MultiRSSqlCE
()
public
void
MultiRSSqlCE
()
{
{
...
@@ -784,7 +796,8 @@ public class AuthorCE
...
@@ -784,7 +796,8 @@ public class AuthorCE
public
int
ID
{
get
;
set
;
}
public
int
ID
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
}
}
#endif
#if LINQ2SQL
[
Fact
]
[
Fact
]
public
void
TestLinqBinaryToClass
()
public
void
TestLinqBinaryToClass
()
{
{
...
@@ -2226,7 +2239,7 @@ public void SO24605346_ProcsAndStrings()
...
@@ -2226,7 +2239,7 @@ public void SO24605346_ProcsAndStrings()
class
PracticeRebateOrders
class
PracticeRebateOrders
{
{
public
string
fTaxInvoiceNumber
;
public
string
fTaxInvoiceNumber
;
#if
EXTERNALS
#if
!COREFX
[
System
.
Xml
.
Serialization
.
XmlElementAttribute
(
Form
=
System
.
Xml
.
Schema
.
XmlSchemaForm
.
Unqualified
)]
[
System
.
Xml
.
Serialization
.
XmlElementAttribute
(
Form
=
System
.
Xml
.
Schema
.
XmlSchemaForm
.
Unqualified
)]
#endif
#endif
public
string
TaxInvoiceNumber
{
get
{
return
fTaxInvoiceNumber
;
}
set
{
fTaxInvoiceNumber
=
value
;
}
}
public
string
TaxInvoiceNumber
{
get
{
return
fTaxInvoiceNumber
;
}
set
{
fTaxInvoiceNumber
=
value
;
}
}
...
@@ -2385,7 +2398,7 @@ public void Issue22_ExecuteScalar()
...
@@ -2385,7 +2398,7 @@ public void Issue22_ExecuteScalar()
int
?
k
=
connection
.
ExecuteScalar
<
int
?>(
"select @i"
,
new
{
i
=
default
(
int
?)
});
int
?
k
=
connection
.
ExecuteScalar
<
int
?>(
"select @i"
,
new
{
i
=
default
(
int
?)
});
k
.
IsNull
();
k
.
IsNull
();
#if E
XTERNALS
#if E
NTITY_FRAMEWORK
Dapper
.
EntityFramework
.
Handlers
.
Register
();
Dapper
.
EntityFramework
.
Handlers
.
Register
();
var
geo
=
DbGeography
.
LineFromText
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
,
4326
);
var
geo
=
DbGeography
.
LineFromText
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
,
4326
);
var
geo2
=
connection
.
ExecuteScalar
<
DbGeography
>(
"select @geo"
,
new
{
geo
});
var
geo2
=
connection
.
ExecuteScalar
<
DbGeography
>(
"select @geo"
,
new
{
geo
});
...
@@ -3022,7 +3035,7 @@ class Issue295Person
...
@@ -3022,7 +3035,7 @@ class Issue295Person
public
DateTime
?
DoB
{
get
;
set
;
}
public
DateTime
?
DoB
{
get
;
set
;
}
public
DateTime
?
DoB2
{
get
;
set
;
}
public
DateTime
?
DoB2
{
get
;
set
;
}
}
}
#if
EXTERNALS
#if
FIREBIRD
[
Fact
(
Skip
=
"Bug in Firebird; a PR to fix it has been submitted"
)]
[
Fact
(
Skip
=
"Bug in Firebird; a PR to fix it has been submitted"
)]
public
void
Issue178_Firebird
()
public
void
Issue178_Firebird
()
{
{
...
@@ -3059,7 +3072,9 @@ public void Issue178_Firebird()
...
@@ -3059,7 +3072,9 @@ public void Issue178_Firebird()
count
.
IsEqualTo
(
1
);
count
.
IsEqualTo
(
1
);
}
}
}
}
#endif
#if OLEDB
[
Fact
]
[
Fact
]
public
void
PseudoPositionalParameters_Simple
()
public
void
PseudoPositionalParameters_Simple
()
{
{
...
@@ -3204,9 +3219,9 @@ class Cat
...
@@ -3204,9 +3219,9 @@ class Cat
};
};
[
Fact
]
[
Fact
]
public
void
TestPostresqlArrayParameters
()
public
void
TestPost
g
resqlArrayParameters
()
{
{
using
(
var
conn
=
new
NpgsqlConnection
(
"Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest
;Encoding=UNICODE"
))
using
(
var
conn
=
new
NpgsqlConnection
(
"Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest
"
))
// ;Encoding=UNICODE
{
{
conn
.
Open
();
conn
.
Open
();
IDbTransaction
transaction
=
conn
.
BeginTransaction
();
IDbTransaction
transaction
=
conn
.
BeginTransaction
();
...
...
Dapper.Tests/project.json
View file @
a4bb66de
...
@@ -26,7 +26,18 @@
...
@@ -26,7 +26,18 @@
"frameworks"
:
{
"frameworks"
:
{
"net40"
:
{
"net40"
:
{
"compilationOptions"
:
{
"compilationOptions"
:
{
"define"
:
[
"MYSQL"
]
"define"
:
[
"MYSQL"
,
"ENTITY_FRAMEWORK"
,
"LINQ2SQL"
,
"FIREBIRD"
,
"SQL_CE"
,
"OLEDB"
,
"MASSIVE"
,
"ORMLITE"
,
"SOMA"
,
"SIMPLEDATA"
]
},
},
"frameworkAssemblies"
:
{
"frameworkAssemblies"
:
{
"System.Configuration"
:
"4.0.0.0"
,
"System.Configuration"
:
"4.0.0.0"
,
...
@@ -35,17 +46,40 @@
...
@@ -35,17 +46,40 @@
"System.Xml"
:
"4.0.0.0"
"System.Xml"
:
"4.0.0.0"
},
},
"dependencies"
:
{
"dependencies"
:
{
"Dapper.EntityFramework"
:
{
"target"
:
"project"
},
"EntityFramework"
:
"6.1.3"
,
"FirebirdSql.Data.FirebirdClient"
:
"4.10.0"
,
"Microsoft.SqlServer.Types"
:
"11.0.2"
,
"MySql.Data"
:
"6.9.8"
,
"NHibernate"
:
"4.0.4.4000"
,
"NHibernate"
:
"4.0.4.4000"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"Simple.Data.Ado"
:
"1.0.0-rc3"
,
"Simple.Data.Core"
:
"1.0.0-rc3"
,
"Simple.Data.SqlServer"
:
"1.0.0-rc3"
,
"Soma"
:
"1.8.0.7"
,
"Soma"
:
"1.8.0.7"
,
"
xunit"
:
"1.9.2
"
,
"
System.Data.SqlServerCe_unofficial"
:
"4.0.8482.1
"
,
"
MySql.Data"
:
"6.9.8
"
"
xunit"
:
"1.9.2
"
}
}
},
},
"net45"
:
{
"net45"
:
{
"compilationOptions"
:
{
"compilationOptions"
:
{
"define"
:
[
"ASYNC"
,
"MYSQL"
]
"define"
:
[
"ASYNC"
,
"MYSQL"
,
"ENTITY_FRAMEWORK"
,
"LINQ2SQL"
,
"FIREBIRD"
,
"SQL_CE"
,
"POSTGRESQL"
,
"OLEDB"
,
"MASSIVE"
,
"ORMLITE"
,
"SOMA"
,
"SIMPLEDATA"
]
},
},
"frameworkAssemblies"
:
{
"frameworkAssemblies"
:
{
"System.Configuration"
:
"4.0.0.0"
,
"System.Configuration"
:
"4.0.0.0"
,
...
@@ -55,12 +89,25 @@
...
@@ -55,12 +89,25 @@
"System.Xml"
:
"4.0.0.0"
"System.Xml"
:
"4.0.0.0"
},
},
"dependencies"
:
{
"dependencies"
:
{
"Dapper.EntityFramework"
:
{
"target"
:
"project"
},
"EntityFramework"
:
"6.1.3"
,
"FirebirdSql.Data.FirebirdClient"
:
"4.10.0"
,
"Microsoft.SqlServer.Types"
:
"11.0.2"
,
"MySql.Data"
:
"6.9.8"
,
"NHibernate"
:
"4.0.4.4000"
,
"NHibernate"
:
"4.0.4.4000"
,
"Npgsql"
:
"3.0.5"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"Simple.Data.Ado"
:
"2.0.0-alpha1"
,
"Simple.Data.Core"
:
"2.0.0-alpha1"
,
"Simple.Data.SqlServer"
:
"2.0.0-alpha1"
,
"Soma"
:
"1.8.0.7"
,
"Soma"
:
"1.8.0.7"
,
"xunit"
:
"2.1.0"
,
"Susanoo.Core"
:
"1.2.4"
,
"MySql.Data"
:
"6.9.8"
"Susanoo.SqlServer"
:
"1.2.4"
,
"System.Data.SqlServerCe_unofficial"
:
"4.0.8482.1"
,
"xunit"
:
"2.1.0"
}
}
},
},
"dotnet5.4"
:
{
"dotnet5.4"
:
{
...
@@ -80,37 +127,50 @@
...
@@ -80,37 +127,50 @@
},
},
"dnx451"
:
{
"dnx451"
:
{
"compilationOptions"
:
{
"compilationOptions"
:
{
"define"
:
[
"ASYNC"
,
"EXTERNALS"
,
"DNX"
,
"MYSQL"
]
"define"
:
[
"ASYNC"
,
"MYSQL"
,
"ENTITY_FRAMEWORK"
,
"LINQ2SQL"
,
"FIREBIRD"
,
"SQL_CE"
,
"POSTGRESQL"
,
"OLEDB"
,
"MASSIVE"
,
"ORMLITE"
,
"SOMA"
,
"SIMPLEDATA"
]
},
},
"frameworkAssemblies"
:
{
"frameworkAssemblies"
:
{
"System.Configuration"
:
"4.0.0.0"
,
"System.Configuration"
:
"4.0.0.0"
,
"System.Data.Linq"
:
"4.0.0.0"
"System.Data"
:
"4.0.0.0"
,
"System.Data.Linq"
:
"4.0.0.0"
,
"System.Runtime"
:
"4.0.0.0"
,
"System.Xml"
:
"4.0.0.0"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
NHibernate"
:
"4.0.4.4000"
,
"
Dapper.EntityFramework"
:
{
"NHibernate.ByteCode.LinFu"
:
"1.1.0"
,
"target"
:
"project"
"NHibernate.ByteCode.Castle"
:
"3.3.3.4000"
,
}
,
"EntityFramework"
:
"6.1.3"
,
"EntityFramework"
:
"6.1.3"
,
"FirebirdSql.Data.FirebirdClient"
:
"4.10.0"
,
"Microsoft.SqlServer.Types"
:
"11.0.2"
,
"MySql.Data"
:
"6.9.8"
,
"NHibernate"
:
"4.0.4.4000"
,
"Npgsql"
:
"3.0.5"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"ServiceStack.OrmLite.SqlServer"
:
"4.0.48"
,
"Microsoft.SqlServer.Compact"
:
"4.0.8876.1"
,
"Simple.Data.Ado"
:
"2.0.0-alpha1"
,
"Microsoft.SqlServer.Types"
:
"11.0.2"
,
"Npgsql"
:
"2.1.0"
,
"Soma"
:
"1.8.0.7"
,
"xunit"
:
"2.1.0"
,
"xunit.runner.dnx"
:
"2.1.0-*"
,
"BLToolkit"
:
"4.1.21"
,
"Susanoo.Core"
:
"0.8.4.36"
,
"SubSonic"
:
"3.0.0.4"
,
"Simple.Data.Core"
:
"2.0.0-alpha1"
,
"Simple.Data.Core"
:
"2.0.0-alpha1"
,
"Simple.Data.SqlServer"
:
"2.0.0-alpha1"
,
"Simple.Data.SqlServer"
:
"2.0.0-alpha1"
,
"FirebirdSql.Data.FirebirdClient"
:
"4.8.1.1"
,
"Soma"
:
"1.8.0.7"
,
"Dapper.EntityFramework"
:
{
"Susanoo.Core"
:
"1.2.4"
,
"target"
:
"project"
"Susanoo.SqlServer"
:
"1.2.4"
,
},
"System.Data.SqlServerCe_unofficial"
:
"4.0.8482.1"
,
"MySql.Data"
:
"6.9.8"
"xunit"
:
"2.2.0-beta1-build3239"
,
"xunit.runner.dnx"
:
"2.1.0-rc1-build204"
}
}
},
},
"dnxcore50"
:
{
"dnxcore50"
:
{
"compilationOptions"
:
{
"compilationOptions"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment