GithubHelp home page GithubHelp logo

Comments (4)

pimbrouwers avatar pimbrouwers commented on July 25, 2024

Howdy!

Thanks for reaching out. I think this is a great idea, even though it may only serve a small slice of people.

As opposed to adding sproc-variants to all the existing methods, which I'm worried would just further pollute the API, I've parameterized (as you suggested) the command type of newIDbCommand. Here's the relevant snippet from the source:

/// Create a new IDbCommand  
let newIDbCommand (commandType : CommandType) (sql : string) (tran : IDbTransaction) =
    let cmd = tran.Connection.CreateCommand()
    cmd.CommandType <- commandType
    cmd.CommandText <- sql
    cmd.Transaction <- tran
    cmd 

/// Create a new CommanType.Text IDbCommand  
let newTextDbCommand (sql : string) (tran : IDbTransaction) =
    newIDbCommand CommandType.Text sql tran

/// Create a new CommanType.StoredProcedure IDbCommand  
let newSprocDbCommand (sprocName : string) (tran : IDbTransaction) =
    newIDbCommand CommandType.StoredProcedure sprocName tran

/// Create a new CommandType.Text IDbCommand  
let newCommand (sql : string) (dbParams : DbParam list) (tran : IDbTransaction) =
    let cmd = newTextDbCommand sql tran
    assignDbParams cmd dbParams
    cmd

/// Create a new CommandType.Text IDbCommand  
let newSproc (sprocName : string) (dbParams : DbParam list) (tran : IDbTransaction) =
    let cmd = newSprocDbCommand sprocName tran
    assignDbParams cmd dbParams
    cmd

The presence of newSproc should allow for those needed the functionality to create Donald-style extensions for Exec, Scalar, Query etc. as needed.

Make sense?

v3.0.2, which includes this change, should be available on NuGet by the time you read this message :)

Ciao for now!

from donald.

willnationsdev avatar willnationsdev commented on July 25, 2024

This looks like a great change. The glories of open source! :-D I think this will enable us to proceed further. Thanks for your efforts.

from donald.

pimbrouwers avatar pimbrouwers commented on July 25, 2024

@willnationsdev That honestly puts a big smile on my face. Thanks for touching base and using the library!

from donald.

willnationsdev avatar willnationsdev commented on July 25, 2024

Just commenting here to mention that, in practice, it became a real pain to have to manually create the query operations that used stored procedures instead of queries, but we still want to use stored procedures, so I recently just duplicated all of the functions with sproc versions. For anyone else that sees this Issue and wants a version of this repo that has full sproc support, they can get it here. All functions just have a Sproc added to the end of their name, unless it ends in Async, in which case, it became SprocAsync. It's a ton of code duplication (sorry DRY), but the ease of use should be a lot better I think.

Edit: I was just using this for private use, and figured I'd shared it in case it was useful, but if pimbrouwers wants to merge those changes himself, then by all means. Not trying to make a competing space or anything.

from donald.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.