Reputation: 3255
I'm calling ExecuteSqlCommand several thousands times per minute and each one is a round-trip to the database. The command itself calls a stored procedure and the parameters vary from INTs to NVARCHARS to "Structured" table-value parameters. When I look at the SQL commands generated by Entity Framework via SQL Profiler quite a sizeable chunk of data is being sent to the DB.
Given that there is no return value from the SP, it's very much "fire and forget", I'd like to try to batch up the SQL commands and send, say, a batch of 10 at once. Is this possible using Entity Framework? Is there a way to get Entity Framework to return me the full SQL command per call and then I could concatenate the SQL myself and call ExecuteSqlCommand myself?
Upvotes: 1
Views: 1775
Reputation: 31610
EntityFramework currently does not support batching. However if you are just executing SQL queries then I don't see a benefit of using EntityFramework. You can go one level below to pure ADO.NET where it is supported to send Sql commands in batches. Take a look at this MSDN post for more details: http://msdn.microsoft.com/en-us/library/aadf8fk2.aspx
Upvotes: 2