How to run Procedures with Dapper

3

How can I run a store procedure with Dapper?

    
asked by anonymous 10.11.2016 / 18:41

1 answer

3

Assuming you wanted to get the result in a variable of type Cliente .

var cliente = connection.Query<Cliente>("spClientes", new {Id = 1}, 
                                    commandType: CommandType.StoredProcedure).First();

The first parameter is the name of the procedure, the second is the parameters passed to it, and the third is the type of command that will be executed.

    
10.11.2016 / 18:56