How to call UDF with Dapper?

Is there any way to invoke a UDF table value with Dapper, except:

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

I prefer to avoid magic lines, so I would like to use something similar to calling SP syntax.

I am using MS SQL Server 2008 R2.

+7
source share
1 answer

Not. Dapper basically (with several settings) follows the same rules as ADO.NET, and in both ADO.NET and raw TSQL, what you published is the only way to invoke UDF, so it remains the syntax used by dapper. In addition, when calling UDF, you need to specify a schema name (usually dbo.My_UDF ).

+7
source

All Articles