Skip to content
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

Adding pipeline API? #86

Open
eagle-k opened this issue May 17, 2023 · 1 comment
Open

Adding pipeline API? #86

eagle-k opened this issue May 17, 2023 · 1 comment

Comments

@eagle-k
Copy link

eagle-k commented May 17, 2023

This is a proposal to add a new API to this library.
When using plain Dapper, it would be useful to be able to pass CommandText, Parameters, etc. through the pipeline.
The following is an example code.

[<CLIMutable>]
type Customer = { Id: int; Name: string }

task {
    use connection = // ...
    do! connection.OpenAsync(cts.Token)

    return!
        "select Id, Name from Customer where ID = @ID"
        |> CommandDef.create
        |> CommandDef.withParameters {| ID = 42 |}
        |> CommandDef.withCancellationToken cts.Token
        |> connection.QuerySingleAsync<Customer>
}

It would be great to see Dapper.FSharp support the F# idiomatic pipeline API for plain Dapper cases.

Prototype:
https://github.com/eagle-k/Dapper.FSharp.Pipeline

This prototype also includes support for F# Async.
F# Async should come in handy when dealing with CancellationToken.

@Dzoukr
Copy link
Owner

Dzoukr commented May 18, 2023

Hi @eagle-k,

I like this approach, but I am not sure how it will work with the current LINQ-like API (mainly based on computation expressions). I think this should be a separated project not necessarily based on Dapper.FSharp? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants