Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dapper invalid type owner

Tags:

c#

dapper

I was just trying out Dapper for the very first time.

When I try to execute a query like the following, I encounter an ArgumentException "invalid type owner for DynamicMethod". Unlinke in this question, inserts work just fine when using Execute().

var parameters = new[] { new { accountName = name, accountPassword = password } };
var accounts = connection.Query<Account>(@"SELECT * FROM " + this.TableName + " WHERE name = @accountName AND password = @accountPassword", parameters);

I am building against .NET 4.5 on Win7.

Can anybody tell what I am doing wrong?

like image 927
Structed Avatar asked May 26 '14 09:05

Structed


1 Answers

Your parameters should just be:

var parameters = new { accountName = name, accountPassword = password };

Not sure what you are trying to do with the new[] new

like image 101
E.J. Brennan Avatar answered Sep 29 '22 16:09

E.J. Brennan