Skip to content
Advertisement

Tag: dapper

How to combine multiple INSERT INTO’s with prepared statements?

Using Dapper, is there a way to form this into one query with the prepared statements? The length of userIds is dynamic. Answer One of the many advantages of Dapper over straight ADO.NET is the simplicity of inserting a list of data to a table. You just need a list of a class <T> where the properties of the class

What is the proper way of selecting multiple scalars within the same “using” statement with Dapper?

I have wrote the following method, which I hoped to make the method run faster by executing the tasks in parallel: Unfortunately, I receive the following exception: System.InvalidOperationException: ‘BeginExecuteReader requires an open and available Connection. The connection’s current state is connecting.’ How should I implement it correctly? Answer First things first, executing many commands in parallel against a database will

Deserialize Postgres ARRAY [@tags] to List with Dapper?

I’m using Dapper with Npsql (Postgres). I’m saving a serialized list of strings to one column called tags: which is resulting in {{first,second}} in the database. My question is how to read it back to the model? Do I need some special SQL, or can I use SELECT id, text, tags FROM account;? How can I dapper tell to deserialize

‘Procedure Has Too Many Arguments’ Error Although I Have Only Two

I checked the other posts related to this problem but could not find any answers. I have a post action method for my hotel api and in the Hotel Repository I have this CreateHotel method below. I just enter two arguments and there’s two arguments in the stored procedure too but I get this error: System.Data.SqlClient.SqlException (0x80131904): Procedure or function

Issues with Dapper query syntax

little assistance here with my query using dapper, been getting error Message = “ORA-00936: missing expressionn” on my query. I would like to know what am I missing here? Answer Firstly with Oracle queries you need to use : instead of @ to denote a parameter placeholder. Then secondly this code: will produce an object with a property called RouteId.

Advertisement