{"action":"created","issue":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/485","repository_url":"https://api.github.com/repos/StackExchange/dapper-dot-net","labels_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/485/labels{/name}","comments_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/485/comments","events_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/485/events","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/485","id":142708251,"number":485,"title":"Cannot read results of a MultiExec","user":{"login":"twhitbeck","id":762471,"avatar_url":"https://avatars.githubusercontent.com/u/762471?v=3","gravatar_id":"","url":"https://api.github.com/users/twhitbeck","html_url":"https://github.com/twhitbeck","followers_url":"https://api.github.com/users/twhitbeck/followers","following_url":"https://api.github.com/users/twhitbeck/following{/other_user}","gists_url":"https://api.github.com/users/twhitbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/twhitbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twhitbeck/subscriptions","organizations_url":"https://api.github.com/users/twhitbeck/orgs","repos_url":"https://api.github.com/users/twhitbeck/repos","events_url":"https://api.github.com/users/twhitbeck/events{/privacy}","received_events_url":"https://api.github.com/users/twhitbeck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-22T16:45:39Z","updated_at":"2016-03-22T23:18:47Z","closed_at":null,"body":"I often use the `OUTPUT` clause to get a generated Id upon inserting a record.\r\n\r\n```sql\r\nINSERT INTO Table (A, B, C)\r\nOUTPUT inserted.Id\r\nVALUES (@A, @B, @C)\r\n```\r\n\r\nThis works well with `ExecuteScalar`\r\n\r\n```cs\r\nvar newId = connection.ExecuteScalar<int>(sql, thing);\r\n```\r\n\r\nHowever, if I want to insert multiple records at once, I can't find a way to read the results of a MultiExec to get the ids. `Query` doesn't interpret `IEnumerable` params like `Execute` does, and when I use `ExecuteReader` I get an error \"MultiExec is not supported by ExecuteReader\".\r\n\r\nIs there a way to do what I want?"},"comment":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/comments/200074994","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/485#issuecomment-200074994","issue_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/485","id":200074994,"user":{"login":"mgravell","id":17328,"avatar_url":"https://avatars.githubusercontent.com/u/17328?v=3","gravatar_id":"","url":"https://api.github.com/users/mgravell","html_url":"https://github.com/mgravell","followers_url":"https://api.github.com/users/mgravell/followers","following_url":"https://api.github.com/users/mgravell/following{/other_user}","gists_url":"https://api.github.com/users/mgravell/gists{/gist_id}","starred_url":"https://api.github.com/users/mgravell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgravell/subscriptions","organizations_url":"https://api.github.com/users/mgravell/orgs","repos_url":"https://api.github.com/users/mgravell/repos","events_url":"https://api.github.com/users/mgravell/events{/privacy}","received_events_url":"https://api.github.com/users/mgravell/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T23:18:47Z","updated_at":"2016-03-22T23:18:47Z","body":"> was more efficient by performing only one INSERT. Is that the case?\r\n\r\nNo, that is not the case. Dapper can't rewrite your query to that extent (although that would be nice, right?). When using the `*Async` API with MARS enabled, what it *can* do is run all the operations utilizing MARS, so you don't pay n*latency, but: other than that, this is purely a convenience unroll."}}