Commit Graph
143 Commits
Author SHA1 Message Date
mgravell c9f4b535d1 add test for #1431 2020-04-02 10:20:12 +01:00
Wei 61fa083ca3 Add unit test for SqlBuilder with Dapper query (#1369) 2019-12-24 14:14:13 -05:00
Sébastien Ros a18dc63c68 Use InvariantCulture in FlexibleConvert (#1363)
In Sqlite, DateTime is stored as String, and custom serializers ultimately use Convert.ChangeType to do the conversion. The generated code however doesn't set the Invariant culture, and the conversion can fail if the current culture doesn't match the standard DateTime serialization format from Sqlite.
2019-10-25 08:10:24 +01:00
Damir Ainullin d12f1aa999 Use loop variable instead of 0 (#1334)
* Use loop variable instead of 0

* Changed unit test, added additional nesting level
2019-09-27 10:41:49 +01:00
mgravell 7769253d59 framework and tooling lib updates; does *NOT* include the full corpus of 3rd party ADO.NET providers 2019-09-27 10:39:40 +01:00
Nick Craver 1481c4d379 Tooling and project updates (#1333)
This is a branch cleaning up old `#if` clauses, `.csproj` bits, Linux build compatibility, and a few other tid-bits (broken out by commit).

In general: we're on 3.0 tooling and all previous cruft has been removed.
2019-09-26 19:47:55 -04:00
Damir Ainullin 7cac38246a Replaced Connection with GetClosedConnection in some unit tests… (#1337)
…cording to their names.
2019-09-22 09:33:59 -04:00
Jan Joneš a47f23cc75 Handle PostgreSQL chars correctly (#1326)
* Handle char correctly

* Add PostgreSQL char test

* Test for string before testing for char
2019-09-10 09:21:50 +01:00
mgravell 3b8b0cdc8a add APIs for working with the connection pools and client-id 2019-08-30 15:23:15 +01:00
mgravell 16ed3fd985 remove unused oracle ref 2019-08-30 14:33:46 +01:00
mgravell 3fe88fc1e0 add Dapper.ProviderTools lib 2019-08-30 13:33:04 +01:00
mgravell 522bc49a99 rev Microsoft.Data.SqlClient to GA (1.0.19239.1) 2019-08-28 17:09:18 +01:00
Marc Gravell 8152f2c718 WIP: Lib updates and prepare for Microsoft.Data.SqlClient (#1313)
v2 work; primarily prep for split SqlClient
2019-08-28 15:07:32 +01:00
Andrés 4eeb632fd5 Fixed issue #569 with IN and other condition. (#1146) 2019-08-27 17:03:49 +01:00
Joseph Musser 8b49eb691d Stop setting current index local which is nonexistent in ValueTuple deserializer (#1280)
* String and byte[] tuple elements cause InvalidProgramException

* Stop setting current index local which is nonexistent in ValueTuple deserializer
2019-06-13 07:37:41 +01:00
mgravell fcd8a70279 reinstate SqlDataRecord types (major conflict with MSSQLCLIENT, but that is removed for now) 2019-06-12 19:39:12 +01:00
Marc Gravell 9fbba78da0 Make Dapper happy with Microsoft.Data.SqlClient (#1262)
* prep work for adding Microsoft.Data.SqlClient support/tests; SqlClient dependency is not yet removed
2019-06-12 16:24:38 +01:00
Joseph Musser 33d974a5c0 Fixes mapping for C# tuples with more than seven elements (#1242)
* Failing tests for tuples larger than 7

* Special-case IL generation for ValueTuple

* Make value-processing logic available to ValueTuple generation
2019-06-12 16:16:45 +01:00
Marc Gravell d19d6012e7 fix #1228 - rev sqlclient to 4.6.0 (#1229)
* fix #1228 - rev sqlclient to 4.6.0
* use transitive deps for SqlClient
2019-04-05 11:39:04 +01:00
Nigel 733d1734ca When reading Geometry and Geography values from the database, we need to specify the SRID explicitly to retain it in the DbGeometry / DbGeography type. (#1038)
merging, thanks, and sorry for delay
2019-03-27 09:18:05 +00:00
Andrew Sumido ec194429cd Corrected class name from PostcresqlTests to PostgresqlTests (#1144) 2018-11-01 20:56:06 -04:00
David Glassborow 5189fcd43a Tests for #1111 - Inconsistent deserialisation between normal Query<T> and SqlMapper.Parse<T> 2018-09-06 20:33:27 -04:00
Nick Craver 522d150e25 Faster builds + use MySqlConnector
MySql.Data is a travesty at this point - moving to something more stable. Really we weren't testing Dapper with previous test failures, we were testing what mood MySql.Data and NuGet extraction are in and which phase of the moon is about.

Also speeds up the builds with 1 restore and 1 build. We can simplify here because everything is relevant (no wasted builds).
2018-09-03 21:38:27 -04:00
Nick Craver e16c69950c Dapper build fixes, versioning, and SQL CE drop
- Moves to NerdBank git-based versioning
- Cleans up build.ps1 to current (will tweak for older moves later)
- Updates xUnit to latest
- Moves to dotnet test, since they killed dotnet xunit
- Testing SQL Server CE has become unreasonable. It's gone (minimal cleanup in this commit disabling it).
2018-09-03 20:35:06 -04:00
Hristo Stefanov cd751c21f6 Fixed issue with empty sqldatarecord list as a table valued parameter. (#900)
System.ArgumentException is thrown when passing empty SqlDataRecord list as an anonymous object or as table-valued parameter to Dapper. Added two unit tests.
2018-07-01 16:08:54 -04:00
Nick Craver dfbcaa1601 Test and fix for #591
This brings behavior QueryAsync behavior on par with Query (sync) and properly returns nothing when an empty result set is encountered.
2018-03-06 22:54:06 -08:00
Dominik Herold 80231b4d2b fix equal tests (#944)
* fix equal tests

* fix test
2018-02-13 21:22:50 -05:00
ydango dc374ad105 Shortened the changes
Combined 2 tests into one
2017-11-05 20:07:13 -05:00
ydango 5b52424ca9 Tests for DateTime2 compatibility
This shows the importance of using DbType.DateTime2 in Dynamic Parameters to avoid precision truncation
2017-11-05 20:07:13 -05:00
Nick Craver 071a3fd5a0 .editorconfig and formatting 2017-08-21 16:25:48 -04:00
Nick Craver 7b34be3a25 net40 is dead - remove #if ASYNC bits 2017-08-21 15:25:57 -04:00
Nick Craver 4e99985dcc Fix unit tests 2017-08-21 08:25:02 -04:00
Nick Craver 8bc2f8c1c4 Merge pull request #782 from jiabiao/master
AddDynamicParameters repeated should work  while paramtype is DbString
2017-08-21 08:17:47 -04:00
Nick Craver bdebedea41 Tests: xUnit cleanup
This change:
- Removes the Assert shim
- Uses recommended xUnit methods (improving fail errors)
- Cleans up exception tests
- General test formatting fixes
- Removes the netcoerapp1.0 only testing (oops commit)
2017-08-20 23:00:08 -04:00
Nick Craver 1bd1b4f8f5 Fix for #808
Add dynamic overloads for:
- QueryFirstAsync
- QueryFirstOrDefaultAsync
- QuerySingleAsync
- QuerySingleOrDefaultAsync

This may change a lot in 2.x, but many people asking for them now so here they are. Unit tests also fixed for QuerySingleOrDefaultAsync.

Note: this builds on the netstandard2 branch because of the xUnit changes to go with VS 2017 15.3.
2017-08-20 16:50:56 -04:00
Nick Craver 76c2e186e2 More test fixes 2017-08-20 15:17:33 -04:00
Nick Craver 4637c10097 Upgade libs, fix tests
This uses the new non-parallel-at-the-end I added to xUnit in https://github.com/xunit/xunit/pull/1411 This way we can run any global test that are other-test-unfriendly much more easily.
2017-08-20 14:06:27 -04:00
Nick Craver ac7b9f5a6f Merge branch 'netstandard2' of https://github.com/StackExchange/Dapper into netstandard2 2017-08-15 12:58:07 -04:00
Sergii Volchkov a9560b3193 Enable SqlDataRecord TVPs on netstandard1.3. (#802)
* Enable SqlDataRecord TVPs on netstandard1.3.
* Update netstandard2.0 SqlClient references to Preview 2.
* Skip TransactionScope tests for netcoreapp2.0.
- According to https://github.com/dotnet/corefx/issues/12534, ambient transaction enlistment is not included with .net core 2.0.
* Update references in Dapper.StrongName.
* Disable parallel test run to stabilize flaky type handler tests.
* Disable parallel test run by assembly attribute.
* Move Issue461 tests to TypeHandlerTests.
* Group type handler tests in a collection, re-enable parallelization.
- Being part of the same collection, type handler tests will run sequentially. All other tests can run in parallel.
* Move tests relying on query cache & type maps to a separate collection.
2017-08-15 12:56:33 -04:00
Bill.B.Jia 02644d7791 fix issue #731: AddDynamicParameters repeated if paramtype is DbStiring should work. 2017-05-20 02:48:39 -07:00
Nick Craver ba641f1890 Merge MySQL fixes in 2017-05-13 07:35:54 -04:00
Bradley Grainger a46354a2e2 Fix MySQL tests and disposal (#774)
* Don't create the connection in Dispose: this avoids creating a SQLConnection simply to Dispose it.
* Run MySQL tests against the open MySqlConnection: 'connection' is a protected variable in the TestBase class that is a SQL Server connection, not a MySQL connection.
* Skip broken MySQL tests: as per issue #295, setting "AllowZeroDateTime=True" in the connection string causes an InvalidCastException in SqlMapper.
2017-05-12 18:18:34 -04:00
Nick Craver 7e5bd308f9 netstandard2.0 functionality (w/ runtime breaks)
This adds a netstandard2.0 build to Dapper (and StrongName until v2),
adds a netstandard2.0 test lineup, restores most functionality (except
UDTs for SQL, e.g. .UdtTypeName isn't in netstandard2), and also breaks
things not actually implemented or implemented correctly in
netstandard2.0. Pushing this up so we can work through these with the
.NET teams.

Several things are still broken here (and fail tests):
- Parameter decimal values (not filed yet)
- DataTables as parameters
(https://github.com/dotnet/corefx/issues/19708)
- .GetSchemaTable() (not yet filed, implementation is completely missing
from SqlDataReader in CoreFX)

While the compile is clean, the above are runtime issues.
`SqlParameter.UdtTypeName` is a separate issue, that one just wasn't in
`netstandard2.0` at all...so we can't support UDTs there until it is.
See https://github.com/dotnet/corefx/issues/17126 for details.
2017-05-12 10:03:00 -04:00
Nick Craver d72ae17a22 Dependency: Dapper doesn't need SqlClient, only Data.Common 2017-05-11 09:36:41 -04:00
Nick Craver 4d75b98206 Tests: make analyzers happy because why not 2017-05-08 14:47:36 -04:00
Nick Craver f613234413 Lots of code cleanup, no functional changes 2017-05-07 15:49:01 -04:00
Nick Craver f8d7a7a320 Skip the MySQL FUBAR test
It's indeed broken on their end. We should consider switching providers,
e.g. https://github.com/mysql-net/MySqlConnector/
2017-05-06 20:18:15 -04:00
Nick Craver 60b7807260 Fix SQL spatial type loading 2017-05-06 19:34:28 -04:00
Nick Craver 15c9e35a17 Fix type loads for the builds without SQL in the GAC 2017-05-06 19:17:56 -04:00
Nick Craver a83e0a7777 Fix Microsoft.SqlServer.Types for new .csproj 2017-05-06 19:07:50 -04:00