I am using this query to get data from database.
string nfc = "53f8372c";
var temp = db.tempTable.AsNoTracking().Where(
x =>
x.uid.Equals(nfc, StringComparison.CurrentCultureIgnoreCase)
&& x.ENDED == null
&& x.STATUS.Equals(Constants.ACTIVE)
);
The sql that is generated from this query is:
{SELECT
"Extent1"."ID" AS "ID",
"Extent1"."uid" AS "uid",
"Extent1"."ENDED" AS "ENDED",
"Extent1"."STATUS" AS "STATUS",
FROM "tempTable" "Extent1"
WHERE (("Extent1"."uid" = :p__linq__0) AND ("Extent1"."ENDED" IS NULL) AND ('Active' = "Extent1"."STATUS"))}
Why does it convert 53f8372c to :p__linq__0?
That's just parameterizing the SQL. If you look at the parameters passed to the query, you'll see that :p__linq__0
has a value of 53f8372c
.
This parameterization is helpful, as the server can cache the query plan and reuse it for the same query using different parameter values.
See more on this question at Stackoverflow