Is there a way in entity framework to track down or determine where the ad hoc queries were called from in code? This query is from the Activity Moniter in SQL Server, however I can't tell where it came from in our code, we have a ton of calls. Is there a way to figure this out easily?
SELECT
CASE WHEN ( EXISTS (SELECT
1 AS [C1]
FROM [Test].[DT] AS [Extent1]
WHERE EXISTS (SELECT
1 AS [C1]
FROM [Test].[D] AS [Extent2]
INNER JOIN [Test].[ME] AS [Extent3] ON [Extent2].[EId] = [Extent3].[EId]
WHERE ([Extent1].[DId] = [Extent2].[Id]) AND ([Extent3].[MId] = @p__linq__0)
)
)) THEN cast(1 as bit) ELSE cast(0 as bit) END AS [C1]
FROM ( SELECT 1 AS X ) AS [SingleRowTable1]