-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update table with dynamic column name? #25
Comments
Good day to you too! 😄 If you need this kind of flexibility, where you don't know column name or value upfront, fallback to plain Dapper then. Column names are generated via reflection from anonymous/named records and if you take away this, there's no need to use anything else than plain Dapper like: let updateColumn key column value =
let sql = "UPDATE Persons SET @col = @val WHERE person-id = @key"
let pars = [("col", box column); ("val", box value); ("key", box key)]
connection.ExecuteAsync(sql, pars) |
Thanks a lot! That’s what I’m currently using, just was converting all my functions from plain dapper to your library where I could and this was the only place I couldn’t! So was more curious about passing arguments into expressions as it seemed a good thing to be able to learn.
Loving the library so far, is so easy to use!
…________________________________
From: Roman Provazník ***@***.***>
Sent: Monday, May 10, 2021 4:00:00 PM
To: Dzoukr/Dapper.FSharp ***@***.***>
Cc: dredgy ***@***.***>; Author ***@***.***>
Subject: Re: [Dzoukr/Dapper.FSharp] Update table with dynamic column name? (#25)
Good day to you too! 😄
If you need this kind of flexibility, where you don't know column name or value upfront, fallback to plain Dapper then. Column names are generated via reflection from anonymous/named records and if you take away this, there's no need to use anything else than plain Dapper like:
let updateColumn key column value =
let sql = "UPDATE Persons SET @col = @Val WHERE person-id = @key"
let pars = [("col", box column); ("val", box value); ("key", box key)]
connection.ExecuteAsync(sql, pars)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#25 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ARHIIMMO3JP5HB3WX546BFLTM5Y6BANCNFSM44PBB2NQ>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not exactly a big deal but wanting to do a simple update column function
eg
let updateColumn key column value
Looking at the partial update expression, I’d want something similar to this:
Is this possible? Computation expressions are very confusing to me!
The text was updated successfully, but these errors were encountered: