Skip to content

Adding pipeline API? #86

@eagle-k

Description

@eagle-k

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions