html
php
c
xml
database
linux
android
ruby-on-rails
regex
objective-c
visual-studio
perl
algorithm
facebook
tsql
delphi
mvc
asp
postgresql
dom
I don't think this is a dapper issue; dapper just takes the SQL you offer, and adds any members from the "args" object that it obviously see in the SQL.
The way to investigate this is to try running the same with DbCommand directly - my guess is that it will fail identical. There is going to be some SQL trick to make it work, but that is between you and MySQL. All dapper is doing is:
it doesn't touch "ID", and it is correct that it doesn't do so.
It turns out "MySql Connector/Net" generates the error.
In order to use Non-parameter SQL Variables with MySql Connector/Net, you have to add the following option to your connection string:
See: http://blog.tjitjing.com/index.php/2009/05/mysqldatamysqlclientmysqlexception-parameter-id-must-be-defined.html
You need to declare the ID variable in your sql code:
var sql = @"DECLARE @ID Int; SELECT @ID := id, slug, Title, Text FROM posts WHERE slug = @Slug; SELECT * FROM comments where postid = @ID;";