Can Dapper batch a set of stored proc calls? I see it supports Multiple Results in the documentation but I’m not sure if you can execute multiple stored proc calls using Dapper.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Dapper supports batching commands for stored procs:
The code above reuses the IDbCommand with the text
#spInsert, 3 times. This makes batching inserts a bit more efficient.In general if you worry about perf at this level you would wrap the batch call in a transaction.
Additionally Dapper supports whatever batch you decide to send it:
Which would cause three rows to be inserted.
Further more, if
#spInsertreturned a result set you could useQueryMultipleto execute the batch which would give you 3 record sets to iterate through.