Commit Graph

1624 Commits

Author SHA1 Message Date
Marc Gravell 79b2960a2f AddParameters(IDbCommand): dispatch via IDynamicParameters
A subclass that hides AddParameters and re-implements the interface - the
DynamicParameterWithIntTVP pattern from this very test suite - was skipped
by the direct call, which binds statically to the protected base method.
Routing through the interface uses the runtime type's interface map, so
the subclass version runs, matching what vanilla execution does.
2026-08-18 19:54:31 +01:00
Marc Gravell 3838f0ece5 DynamicParameters.AddParameters(IDbCommand): identity-free self-apply
The full bag protocol (per-parameter DbType/direction/size, templates,
literal replacement, RemoveUnused) already lives in AddParameters(command,
identity), but the identity requirement makes it uncallable from outside:
Identity's constructor is internal, and identity.Sql is consumed on the
first line. This overload builds the identity from the command's own text
and type, which is what identity.Sql is in practice - letting external
tooling (for example build-time code generators, aka Dapper.AOT) apply a
bag without reimplementing the protocol.

Test covers the bag+literal composition against a closed connection (no
database needed).
2026-08-18 17:11:09 +01:00
Marc Gravell c0b2097129 Pin the docs site config, and give it a favicon (#2224)
The site was running on GitHub's defaults, which take the title and description
from the repo's name and description fields - so an edit in the repo settings UI
quietly changed the site's metadata. Those are pinned now, along with the URL,
which is what jekyll-seo-tag uses to build canonical and og:url.

Also: strip_title, so the page title stops being printed twice (once in the
theme's header banner, once as the heading it was derived from); jekyll-sitemap,
which is not in the always-on GitHub Pages plugin set, for the sitemap.xml and
robots.txt the site did not have; and a favicon built from the project logo,
hooked up via the head-custom.html include the theme provides for exactly this.

Claude-Session: https://claude.ai/code/session_01NxkjXSR7CSGzyw89tJJVtw
2026-08-18 14:42:43 +01:00
Marc Gravell 2ca8261e31 Point PackageReleaseNotes at GitHub Releases (#2223)
Release note tracking moved to GitHub Releases some time ago; docs/index.md says so and keeps only an archive below that point. PackageReleaseNotes was still pointing at the docs root, so anyone following it from NuGet landed on the archive and had to make one more hop.
2026-08-18 09:53:13 +01:00
Marc Gravell 752507c619 Point docs links at dapperlib.dev (#2222)
The docs site now has its own domain. The old dapperlib.github.io URLs still work via a redirect, but there's no reason to keep going the long way round, and PackageReleaseNotes in particular is baked into every package we publish.

Also switches PackageProjectUrl to the docs site, matching DapperAOT; RepositoryUrl still points at the source.
2026-08-18 09:41:01 +01:00
Marc Gravell 2ac0daae0e Create CNAME 2026-08-18 09:23:14 +01:00
David Federman 72a54c475f Add ReferenceTrimmer and remove unused references (#2191)
* Add ReferenceTrimmer and remove unused references

* Update Directory.Packages.props

latest

---------

Co-authored-by: Marc Gravell <marc.gravell@gmail.com>
2.1.79
2026-05-16 21:25:15 +01:00
Marc Gravell 953f371805 keep deps up to date (#2204)
* keep deps up to date

* d'oh

* slnx
2026-05-16 21:08:13 +01:00
Andi 2a8faab235 Fix/prefer typehandlers for enums (#2200)
* Add Settings.PreferTypeHandlersForEnums opt-in flag

When enabled, Dapper checks for a registered TypeHandler for enum types
before falling back to the default integer boxing behavior. This allows
custom enum serialization (e.g. storing enums as strings via TypeHandlers)
to work on both reads and writes.

Patched locations:
- LookupDbType: return DbType.Object with handler when flag is on
- CreateParamInfoGenerator: skip integer boxing when handler exists
- GetSimpleValueDeserializer: route to TypeHandler before Enum.ToObject
- Parse<T>: route to TypeHandler before Enum.ToObject

Default is false — zero behavior change for existing users.

* Patch IL-emitted type deserializer and add tests

- Fix 6th enum-before-handler location in GetTypeDeserializer IL emit,
  preserving Nullable<T> wrapping for nullable enum properties
- Fix em-dash in comment (non-ASCII)
- Add two tests: round-trip write+read via StringEnumHandler, and
  nullable enum with null value

* Update SDK version from 10.0.102 to 8.0.100

* Update global.json

we have fixed the CI glitch separately

---------

Co-authored-by: Marc Gravell <marc.gravell@gmail.com>
2026-05-16 21:08:03 +01:00
Henrik 512f024667 Make private & internal classes sealed and less enumeration of lists & LINQ (#2197) 2026-04-29 08:39:02 +01:00
Marc Gravell 464cb337ba Update dependencies (#2202)
* first snapshot, warnings

* intermediate

* more

* more fixings

* cleanup

* nuke NETCOREAPP3_1 ref
2026-04-29 08:38:12 +01:00
Andi b9bdd7c40b Fix segfault when ICustomQueryParameter is a value type (#2189) (#2198)
The IL emitted by CreateParamInfoGenerator used Callvirt to invoke
AddParameter on an unboxed struct sitting on the evaluation stack.
Callvirt expects a reference, so the CLR misinterpreted the raw struct
bytes as an object pointer, causing a fatal CLR error (0x80131506).
2026-04-29 07:29:21 +01:00
Marc Gravell 155a83319a fix CI (#2196)
* fix CI

* try again
2026-04-29 06:23:17 +01:00
Marc Gravell 288730e69b TFM packaging for .NET 10 (#2195) 2.1.72 2026-03-06 07:10:01 +00:00
mgravell 00b1023f29 rev snowflake for clean build 2025-06-01 06:50:51 +01:00
kabaome 5c7143f2e3 CI: serialize DB-dependent tests (#2163)
* CI: serialize DB-dependent tests

* github workflows test
2025-04-30 20:31:40 +01:00
kabaome 5e6a6eb82f CI: use preinstalled sdk (#2160) 2025-04-27 19:34:35 +01:00
ri-rgb d994b6d932 OutputExpression wasn't working for methods that use QueryRowAsync (#2156)
Added command.OnCompleted() to QueryRowAsync

Co-authored-by: Rich <Rich@XPS-15>
2025-04-08 11:07:45 +01:00
Jesper Noordsij e97a919352 Fix and clarify OrWhere caveats in SqlBuilder docs (#2149)
* Fix and clarify OrWhere caveats in SqlBuilder docs

* Add example with OrWhere call first
2025-04-08 11:01:52 +01:00
Marc Gravell bd4f75b512 normalize async API surface over all TFMs (#2144)
* - normalize async API surface over all TFMs (fix #2143)
- target net8.0 instead of net5.0
- lib updates

* net9 SDK

* perf tests: clean up SqlClient warning

* CI fix: test concurrency

* rev snowflake
2.1.66
2025-02-06 12:11:30 +00:00
Marc Gravell 4e57602271 Update main.yml 2025-01-25 18:07:46 +00:00
Marc Gravell cfc2fdd4da install dotnet 2025-01-25 18:04:36 +00:00
Nick Craver 6434c694b2 Build: Update Postgres script (#2130) 2024-10-31 20:38:20 -04:00
Marc Gravell 9f4f783a41 Mark AddTypeHandlerImpl as obsolete and prevent lost updates via AddTypeHandler (#2129)
* - mark AddTypeHandlerImpl as obsolete
- syncronize type-handler mutates, to prevent lost writes

* CI: revert pgsql uddate

* suppress Impl's use of clone: false

* avoid additional local snapshot, now that we're synchronized

* explicitly request postgresql96

* more pgsql poking

* pg path fix
2024-10-31 07:23:21 +00:00
Marc Gravell 00a3808f7d Update issue templates 2024-10-17 13:27:42 +01:00
Andrea Latanza a3804ceb1d fix: properly handle value types when setting properties on dynamic objects returned by Dapper queries (#2122) 2024-10-13 09:31:25 +01:00
Marc Gravell b4f80b6b6b Improve performance of "queryunbuffered", and correctness of "first" APIs (#2121)
* see #2115

- correctness: do no use SingleRow by default; affects trailing errors
- performance: QueryUnbufferedAsync can mirror cmd?.Cancel() in finally (this is consistent with all other scenarios)

* remove settings tweak
2024-10-09 11:15:28 +01:00
Robert Silén e0479ba16d add mention of MariaDB to Readme.md (#2116) 2024-10-08 13:23:18 +01:00
Marc Gravell dddd102eef update package refs and fixup (#2120) 2024-10-08 13:23:00 +01:00
goerch 38df7bb89e Fix #2113 (#2118) 2024-10-07 13:00:15 +01:00
Marc Gravell 70e57f820d appveyor pgsql update (#2119) 2024-10-07 12:50:42 +01:00
Cédric Luthi 9ed3525598 Do not close the inner reader when disposing wrapped data readers (#2100)
When disposing wrapped readers, only call Dispose() on the inner reader and let it catch exceptions if appropriate.

Note: this actually happened with `Microsoft.Data.SqlClient`.

```
Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
 ---> System.ComponentModel.Win32Exception (258): The wait operation timed out.
   at void Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
   at void Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, bool callerHasConnectionLock, bool asyncClose)
   at bool Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, out bool dataReady)
   at bool Microsoft.Data.SqlClient.SqlDataReader.TryCloseInternal(bool closeReader)
   at void Microsoft.Data.SqlClient.SqlDataReader.Close()
   at void Dapper.DbWrappedReader.Dispose(bool disposing) in /_/Dapper/WrappedReader.cs:line 149
   at ValueTask System.Data.Common.DbDataReader.DisposeAsync()
```
2024-07-03 13:32:18 +01:00
Marc Gravell 52160dc446 missed one 2024-04-30 20:28:19 +01:00
Marc Gravell bfa91d3e3c change dapper-plus citation (#2083) 2024-04-30 20:23:51 +01:00
Marc Gravell 13b2ef2cc2 Update NonCLA.md 2024-04-28 10:25:21 +01:00
Marc Gravell 8d7d262871 Update cla.yml 2024-04-28 10:07:12 +01:00
Marc Gravell 9212a8da6e Non-CLA 2024-04-28 10:04:28 +01:00
Marc Gravell d9fed73d00 Merge branch 'main' of https://github.com/DapperLib/Dapper 2024-04-26 09:03:21 +01:00
Marc Gravell 9fdb30a43e disable DateOnly / TimeOnly support - see #2071 / #2072 (#2080) 2024-04-26 09:02:37 +01:00
github-actions[bot] c5f1206933 Creating file for storing CLA Signatures 2024-04-26 07:50:49 +00:00
Marc Gravell 907a4d9b35 disable DateOnly / TimeOnly support - see #2071 / #2072 2024-04-26 08:49:47 +01:00
Marc Gravell 2fa046cd39 Create cla.yml 2024-04-13 09:07:53 +01:00
Marc Gravell b51cc77596 Update Readme.md
(actually just to bump build)
2.1.44
2024-04-12 12:12:02 +01:00
Marc Gravell 92c81bc2c2 fix image in readme 2024-04-12 11:57:42 +01:00
Marc Gravell fa9c96aec0 revert #2050 - see #2049 for more details (#2070)
* revert #2050 - see #2049 for more details
2.1.42
2024-04-12 11:13:05 +01:00
Marc Gravell ad16263ac4 tyop 2024-04-12 09:43:31 +01:00
Marc Gravell a11879c6dc more context 2024-04-12 09:41:32 +01:00
Marc Gravell d40f9f0ca9 image size 2024-04-12 09:17:59 +01:00
Marc Gravell 803e3510ea Dapper Plus (#2069)
add Dapper Plus as sponsor
2024-04-12 09:13:24 +01:00
Marc Gravell 402f20ce37 implement DateOnly/TimeOnly (#2051)
fix #1715
adds net6 TFM
2.1.37
2024-03-07 12:19:30 +00:00