使用参数的优势是什么,与字符串插值相比?
这个:
这个:
SELECT * FROM dbo.Posts WHERE Author = @p0", userSuppliedAuthor;
比这个:
$@SELECT * FROM dbo.Posts WHERE Author = {userSuppliedAuthor}";
更好吗?
con.Query<Posts>("select * from Posts where Author=@author",new {autthor=someAuthor});"
- Panagiotis Kanavos