1

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]
1

1 Answer 1

1

For EF Core this is the reason the Query Tags feature was added, or you can always use logging. For EF6 you can use logging and interception.

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome but this isn’t EF core

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.