Commit Graph

1603 Commits

Author SHA1 Message Date
Damir Ainullin 9b010240c7 Set initial capacity for collections (#1449)
* Set initial capacity for collections
* Revert Massive changes

Co-authored-by: Nick Craver <nrcraver@gmail.com>
2020-05-02 08:15:46 -04:00
Nick Craver 663588f90b AppVeyor: Build tweaks & misc fixes (#1450)
Simplifying and improve build speed.

- Decreases builds from 8-13 minutes down to ~2 minutes (while running more tests)
- Moves to SQL Server 2019 on AppVeyor
- Moves the 2 longest running tests with params to `[FactLongRunning]`
- Bumps tests up to `netcoreapp3.1`
- Also fixes .Contrib tests
- Moves to `Build.csproj`
- Simplifies `build.ps1`
- Removed defunct `build.sh`
- Nukes `IsAppveyor` (moves to environmental variable overloads)
- Builds now work in Linux/macOS
2020-05-02 07:52:40 -04:00
Wei 5c87dc9738 SqlBuilder Support Update Set (#1404)
I add update `Set` method and unit test.

e.g: 
```C#
var sb = new SqlBuilder()
       .Set("vip = @vip", new { vip })
       .Set("updatetime = @updatetime", new { updatetime })
       .Where("id = @id", new { id })
;
var template = sb.AddTemplate("update #Users /**set**/ /**where**/");
connection.Execute(template.RawSql, template.Parameters);
```

RawSql will generate : 
```
update #Users Set vip = @vip , updatetime = @updatetime\n WHERE id = @id\n
```

using Dapper Execute in sqlserver it'll reqeust by below sql command
```
exec sp_executesql N'update #Users Set vip = @vip , updatetime = @updatetime
 WHERE id = @id
',N'@vip bit,@updatetime datetime,@id int',@vip=1,@updatetime='2020-01-01 00:00:00',@id=1
```

Co-authored-by: Nick Craver <nrcraver@gmail.com>
Co-authored-by: Nick Craver <craver@stackoverflow.com>
2020-05-01 19:25:12 -04:00
JulianRooze 2c81a4085a Fix handling of selecting nullable value tuples (#1400)
`SingleOrDefault<(int, int)?>(query)` always returned null because the IsValueTuple did not handle nullable types and thus the `GenerateValueTupleDeserializer` method was never called.

I've added test for the case when the query does not return something (the tuple should be null) and when it does return something. Additionally added tests for the edge-case where you select 8 or 15 element tuples to make sure nothing broke there.
2020-05-01 18:16:23 -04:00
AlexBagnolini 0e04fe1daf Added EF6 performance tests back in netcoreapp3.0 (#1361)
* Added EF6 tests in netcoreapp3.0

* Fix up EF Core ref to always be 6.3.0

Co-authored-by: Alex Bagnolini <alex.bagnolini@ericsoft.com>
Co-authored-by: Nick Craver <craver@stackoverflow.com>
2020-05-01 18:03:52 -04:00
Nick Craver c6952825e8 Update Dapper.Rainbow/Snapshotter.cs
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
2020-05-01 17:36:34 -04:00
bryancrosby 9b6c8c7d7f Fix typo in Snapshotter
Fix small typo and grammar
2020-05-01 17:36:34 -04:00
Chris Donnelly 6aece653be MightyOrm needs a nonstandard connection string.
We are now providing it programmatically so we don't disrupt SQL Server.
2020-05-01 17:27:11 -04:00
Chris Donnelly 455b3f3b11 Adding MightyOrm benchmark. 2020-05-01 17:27:11 -04:00
BlackjacketMack 0b17133fd8 Updated InListStringSplitCount comment to GTE.
The comment suggested that more than the number specified in InListStringSplitCount and it would start to use string_split.  However, it is greater-than-or-equal-to (GTE) the number specified by InListStringSplitCount.
2020-05-01 17:24:39 -04:00
Damir Ainullin 899c9feb63 Replaced constant with index in loop (#1443) 2020-04-28 19:59:12 +01:00
mgravell 7088263aff update release notes 2020-04-06 10:11:05 +01:00
Marc Gravell 765300a32b Enable deterministic build (#1433)
* - enable deterministic build
- lib updates for core packages

* set source root if needed

* Restore VS test runner

xUnit won't run in VS without it :)

Co-authored-by: Nick Craver <craver@stackoverflow.com>
2.0.35
2020-04-05 13:43:31 +01:00
mgravell 4ad80f880e allow SDK roll-forward 2020-03-26 09:53:21 +00:00
Brendan Gooden 121d710067 Allow checking for custom handlers outside Dapper library (For use in SimpleCRUD extension) 2020-01-21 11:58:35 +10:30
Wei 61fa083ca3 Add unit test for SqlBuilder with Dapper query (#1369) 2019-12-24 14:14:13 -05:00
Bernard Vander Beken 1922ef4a8d Use consistent punctuation in XML comment (#1357) 2019-11-03 10:34:00 -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
mgravell 247e498f0e since we're targeting net461 again, ensure contrib tests have coverage 2.0.30 2019-09-27 10:47:36 +01:00
Bernard Vander Beken daf5bea70a Fix spelling (#1340) 2019-09-27 10:42:54 +01:00
Damir Ainullin 981cfe4ddf Replaced ContainsKey and [] with TryGetValue (#1339) 2019-09-27 10:42:46 +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
Jesper Meyer 3b0cd9a9a1 Updated Hand Coded benchmarks (#1206)
Hand coded version did not operate under the same circumstances as others.

- Add CommandBehavior.SingleResult and CommandBehavior.SingleRow. All other framworks does this under the hood.
- Run SqlCommand.Prepare() (perhaps it should be benchmarked as "Compiled"?)
- Use GetNullableValue because it's easier to read and slightly faster
- _table.Rows was incrementally added, which made the benchmark run slower the longer it executed. Added _table.Rows.Clear() to prevent the growth.
- Changed select to use * like other benchmarks
2019-09-22 08:40:07 -04:00
Andrés 77cd19d0e9 Fix performance tests (#1331)
Hi!
This PR tries to fix Dapper.Performance.Tests, actually you can't get [MemoryDiagnoser](https://benchmarkdotnet.org/api/BenchmarkDotNet.Diagnosers.MemoryDiagnoser.html)  stats because 
```IDiagnoser.GetColumnProvider()``` method was gone on BenchmarkDotnet 0.11.2. I choose ```DefaultColumnProviders.Metrics``` because of [this](https://github.com/dotnet/BenchmarkDotNet/issues/1184#issuecomment-507377695), i think it's the most simple way to add stats now.

**Before**
![image](https://user-images.githubusercontent.com/34173061/65264060-1a5f7780-db0e-11e9-9c8c-bb4c69a808df.png)

**After**
![image](https://user-images.githubusercontent.com/34173061/65264158-4f6bca00-db0e-11e9-9313-597b09070ae6.png)

On the other hand i choose removing ```[Ordered]``` as temporal solution of https://github.com/dotnet/BenchmarkDotNet/issues/1238, and yeah, the results are still ordered because of https://github.com/StackExchange/Dapper/blob/9282ef2872e1c82c68c86f31e93e8f1ceaacd409/Dapper.Tests.Performance/Config.cs#L42

**Before**
![image](https://user-images.githubusercontent.com/34173061/65264660-6232ce80-db0f-11e9-9046-9c2d8fc5e2d8.png)

**After**
 (No errors)

Thanks for all!!
2019-09-22 08:12:22 -04:00
Damir Ainullin 4dbf74f4d1 Replaced WriteLine with WriteLineColor 2019-09-22 07:55:04 -04:00
james-hester-ah 61707905f6 Fix issue #418 for DeleteAsync (#1309)
Fix issue #418 for DeleteAsync (with tests)
2019-09-21 09:16:34 -04:00
mgravell 9282ef2872 fix CI 2019-09-12 13:47:05 +01:00
mgravell f12b73a66f update global.json to preview9; /cc #1294 2019-09-12 08:58:35 +01:00
mgravell aefb2840bb reinstate net461 TFM; fix #1325 2019-09-12 08:30:35 +01:00
mgravell 07bc83f2b7 tidy ReadChar/ReadNullableChar with modern C# 2019-09-10 09:25:18 +01: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 e6f63507bf remove the BulkCopy.Register API until I have chance to test it 2019-08-30 16:24:18 +01:00
mgravell 343d36b5c3 #nullable enable 2019-08-30 15:24:01 +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 ed90d66e48 add missing APIs to BulkCopy 2019-08-30 14:19:23 +01:00
mgravell b663914650 use a license expression 2019-08-30 13:52:20 +01:00
mgravell 822a9a33be IDE and command-line disagree on #nullable 2019-08-30 13:38:22 +01:00
mgravell 3fe88fc1e0 add Dapper.ProviderTools lib 2019-08-30 13:33:04 +01:00
mgravell b535277599 oops, 2.0.4 2019-08-29 14:47:59 +01:00
mgravell e9adb722f6 RTM v is 2.0.5 2019-08-29 14:35:03 +01:00
mgravell 597cc69ba5 2.0 RTM 2.0.4 2019-08-29 14:17:14 +01:00
mgravell 522bc49a99 rev Microsoft.Data.SqlClient to GA (1.0.19239.1) 2019-08-28 17:09:18 +01:00
mgravell f5ca275a29 release notes 2019-08-28 15:26:35 +01:00
Marc Gravell 8152f2c718 WIP: Lib updates and prepare for Microsoft.Data.SqlClient (#1313)
v2 work; primarily prep for split SqlClient
2.0-preview1
2019-08-28 15:07:32 +01:00
Dmytro Gokun 6df95cbdbd Expose the underlying connection from Rainbow Database so it's easier to use Dapper alongside other DB frameworks (#1257) 2019-08-27 17:33:14 +01:00
Dmytro Gokun 012e9b6f08 Add ability to override Dispose() in the derived class (#1256) 2019-08-27 17:32:51 +01:00