.net - Is there a way to call a stored procedure with Dapper? -


i impressed results of dapper micro orm stackoverflow.com. considering new project , have 1 concern times project requires have stored procedure , have search lot on web not found stored procedure. there way have dapper work stored procedure?

please let me know if possible otherwise have extend in way.

i checked in rich support procs:

in simple case can do:

var user = cnn.query<user>("spgetuser", new {id = 1},          commandtype: commandtype.storedprocedure).first(); 

if want more fancy, can do:

 var p = new dynamicparameters();  p.add("@a", 11);  p.add("@b", dbtype: dbtype.int32, direction: parameterdirection.output);  p.add("@c", dbtype: dbtype.int32, direction: parameterdirection.returnvalue);   cnn.execute("spmagicproc", p, commandtype: commandtype.storedprocedure);    int b = p.get<int>("@b");  int c = p.get<int>("@c");  

additionally can use exec in batch, more clunky.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

c# - how to write client side events functions for the combobox items -

ssh client with paramiko (python) -