According to the dapper docs one can write
connection.Execute(@"insert into MyTable(colA, colB) values (@a, @b)",
new[] { new { a=1, b=1 }, new { a=2, b=2 }, new { a=3, b=3 } }
)
I tried using
conn.Execute(
@"
insert into RelRoleUser ( RoleID, UserID )
values( @roleID, @userID )",
userroleList.Select(r => new { roleID = r.roleID, userID = r.userID }).ToArray(),
null, null, null);
But get an exception "Invalid type owner for DynamicMethod" in Dapper code
private static Action<IDbCommand, object> CreateParamInfoGenerator(Type type)
{
var dm = new DynamicMethod(string.Format("ParamInfo{0}", Guid.NewGuid()), null, new[] { typeof(IDbCommand), typeof(object) }, type, true);
...
Am I trying to write too clever code or have I misunderstood something else? Stumbled upon a bug?
I am running Dotnet3.5 on Win7.