I have a stored procedure in Azure sql db that, when launched from SSMS, finishes in about 300 ms. Sproc accepts an identifier and a date range, collects some data, and stores it in an aggregation table. It does not return any result.
When it is launched from the EF code, first the ExecuteStoreCommand object (with the same parameters) will take about 60 seconds.
I tried using context.Database.ExecuteSqlCommand and context.Database.SqlQuery also with the same results, very slow!
Can someone explain how this is so that the execution of EF is so slow that it compares with the direct execution of sproc?
Is there a decent tool that can tell me what EF does (profiler?)
source share