Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call UDF with Dapper?

Is there any way to call table-valued UDF with Dapper, except:

var rows = connection.Query("select * from My_UDF(@a,@b)", new {a=1, b=2 });

I prefer to avoid magic strings hence I would like to use something similar to calling SP syntax.

I use MS SQL Server 2008 R2.

like image 373
yegor.n.a Avatar asked Oct 05 '12 21:10

yegor.n.a


1 Answers

No. Dapper basically (with a few tweaks) follows the same rules as ADO.NET, and in both ADO.NET and raw TSQL, what you have posted is the only way of invoking a UDF - therefore, that remains the syntax used by dapper. Additionally, when calling a UDF you are required to specify the schema-name (typically dbo.My_UDF).

like image 138
Marc Gravell Avatar answered Oct 07 '22 13:10

Marc Gravell