It's not a mistake. Dapper should choose the SQL data type for the string parameter without looking at the database structure (not to mention analyzing your query and determining that you are inserting the parameter into a specific column).
Imagine if you do this:
insert Clients(name) values(@Name + 'abc')
Should Dapper find out that @Name can contain up to 47 characters?
You can be more specific about the size of your parameter if you want:
con.Execute(@" insert Clients(name) values(@Name)", new { Name = new DbString { Value = "John", Length = 50 }});
source share