I'm new in Dapper. I trying to create new project and map local database by Dapper. Unfortunately I always receive this error:
Could not load type 'Dapper.SqlMapper' from assembly 'Dapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
I added Dapper by NuGet (Dapper v. 1.39.0.0). This is example of my code:
public static IEnumerable<TBMobileDetails> Allmobilelisting()
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=""c:\users\database.mdf"";Integrated Security=True");
string query = "select * from Mobiledata";
var result = con.Query<TBMobileDetails>(query);
return result;
}
Where is the problem?
This problem occurs generally when there is an object / class / type named
Do following steps to remove this issue
My problem was that there was a namespace collision. Maybe a little obvious, but don't name anything "dapper" in your project.
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