Per eaxmple, LINQ to SQL sta inviando il seguente:Perché LINQ invia sp_executesql invece di eseguire direttamente l'SQL?
exec sp_executesql
N'SELECT [t0].[HomeID],
[t0].[Bedrooms],
[t0].[ImageURL],
[t0].[Price],
[t0].[Available],
[t0].[Description]
FROM
[dbo].[Homes] AS [t0]
WHERE
([t0].[Description] LIKE @p0) AND
([t0].[Available] = @p1) AND
([t0].[Price] >= @p2) AND ([t0].[Price] <= @p3)
ORDER BY
[t0].[Price] DESC',
N'@p0 nvarchar(4000),@p1 int,@p2 int,@p3 int',
@p0=N'%private%',
@p1=1,
@p2=200000,
@p3=750000
Perché si utilizza sp_executesql?
OP, dovresti chiarire cosa intendi un po '- lo prendo guardando attraverso SQL Profiler e vedi le chiamate che scorrono. Interpreto la tua domanda come "perché L2S usa sp_executesql piuttosto che inviare direttamente le istruzioni contenute". – stephbu