According to dapper docs 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 to use
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 the "Invalid type owner for DynamicMethod" exception 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 smart code or am I misunderstood something else? Stumbled upon a mistake?
I am running Dotnet3.5 on Win7.
source share