Dzoukr / Dapper.FSharp

Lightweight F# extension for StackOverflow Dapper with support for MSSQL, MySQL, PostgreSQL, and SQLite
MIT License
366 stars 35 forks source link

Add support to output inserted, updated and deleted values. Fix issue with using option values in Map parameters for dapper #2

Closed ssiltanen closed 4 years ago

ssiltanen commented 4 years ago

Created three new methods to get inserted, updated and deleted values without a separate query: InsertOutputAsync, UpdateOutputAsync, and DeleteOutputAsync.

Update and delete were easy to alter to output stuff, but with insert it was necessary to change object parameters to Map parameters. Otherwise dapper throws an exception when the function is called.

Also noticed a bug where parameters to dapper are given in a Map. If one provided any Some 'a value to dapper in that Map, dapper would throw an "Implicit conversion from data type sql_variant to is not allowed". The added boxify function solves that problem.

Also, sorry, I probably should have done a separate PR for this, but at least these changes are in a separate commit. Removed trailing whitespaces and added .editorconfig file to help keep the files tidy. The editor config should change nothing in your setup except for the trailing spaces.

Dzoukr commented 4 years ago

Hi @ssiltanen, that's great contribution - thanks for that! Will check tests and release soon.

Dzoukr commented 4 years ago

Aaaaaand it's published. Thanks again!