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.
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With