Comments (4)
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.
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.
@willnationsdev That honestly puts a big smile on my face. Thanks for touching base and using the library!
from donald.
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)
- GetDateTimeOffset Signature is string -> DateTime HOT 1
- Unable to execute query without a transaction HOT 6
- Add a wrapper around ExecuteScalar HOT 6
- TransactionBuilder HOT 9
- CommandBehavior.SequentialAccess causes error with SqlHydra readers HOT 5
- Cast exception when reading DateTimeOffset with System.Data.SqlClient HOT 4
- [Help] How to parse results with sequential access? HOT 2
- Db.Async.execMany throws "A command is already in progress" with NPGSQL HOT 5
- v.7.0.0 HOT 9
- FsDto lib review HOT 2
- Who is @dysme on the landing page? HOT 3
- CancellationToken support
- Support of transaction in newCommand in Fluent syntax HOT 3
- Getting error while using Db.Async.query method HOT 6
- Require help on query HOT 7
- Support or Transition to Microsoft.Data.SqlClient HOT 3
- SQLite: What SQL Type should I choose for a JSON column? HOT 2
- Possible issue with Db.Async.exec throwing instead of returning a Result HOT 1
- How to deal with DB enums in Donald? HOT 1
- Doc comment error for newSproc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from donald.