SqlDatabase.BeginExecuteNonQuery vs SqlCommand.BeginExecuteNonQuery

Topics: Data Access Application Block
Sep 30, 2013 at 11:19 AM

Apologies in advance if this is way too silly question.

the definition of entlib beginExecuteQuery from MS site is "Initiates the asynchronous execution of the SqlCommand which will return the number of affected records."

does that mean, it is same as something like
Task.Factory.FromAsync<int>(sqlcommand.BeginExecuteNonQuery, sqlcommand.EndExecuteNonQuery, state); ?

would really help me if someone can confirm this.

Many thanks in advance.
Oct 1, 2013 at 3:06 AM
I would say conceptually it's the same but the actual implementation is different. Enterprise Library does handle disposing of objects and closing the connection (as it does with other Database methods).

Randy Levy
Enterprise Library support engineer
Support How-to
Oct 1, 2013 at 10:34 AM
Edited Oct 1, 2013 at 10:40 AM
Thank you Randy