I realize this might simply be a bug or oversight, but I sincerely doubt it:
When I run the following code:
using(var cnn = new SqlConnection(cnnString)) {
return cnn.Query<Foo>("select top 15 * from Foo");
}
The Dapper Query method opens the connection before it runs anything.
When i run this code:
using(var cnn = new SqlConnection(cnnString)) {
cnn.Execute("insert Foo(bar_id, name) values (@bar_id, @name)", fooList);
}
The code throws with an InvalidOperationException:
ExecuteNonQuery requires an open and available Connection.
The connection's current state is closed.
It sounds like this question, but I can't tell if there's some reason why Execute can't be doing the same logic.
My question is why, or if not, should I file a bug?