I am debugging some duplicate sql statements in my MVC app using miniprofiler.
I'm struggling to find where some sql statements originate and quite a few of these declare a parameter at the beginning EntityKeyValue
.
For example: DECLARE @EntityKeyValue1 int = 10;
Is this some kind of internal working of linq / linq to entities?
I've googled it but am not having much joy. That often means I'm misunderstanding something or missing something obvious - am I?
Update
I've dug around some more and I realise that it is just a parameter. However most parameters I've seen look like this:
DECLARE @p__linq__0 int = 10;
So now my question is - what is the difference between these 2 types of parameter declarations? Where is the EntityKeyValue coming from?
EntityKeyValue
is a parameter that is auto-generated by Entity Framework (see this file, line 55).
MiniProfiler captures parameters in the SqlServerFormatter class.