Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DebugView for query and simple way to get SQL from an EF LINQ query #19324

Merged
merged 1 commit into from
Dec 15, 2019

Commits on Dec 15, 2019

  1. DebugView for query and simple way to get SQL from an EF LINQ query

    Fixes #6482
    
    Given a query like:
    ```C#
    var query = context.Set<Customer>().Where(c => c.City == city);
    ```
    
    The SQL that will be generated for this query can be obtained by:
    
    ```C#
    var queryString = query.ToQueryString();
    ```
    
    and looks like this:
    ```sql
    -- @__city_0='London' (Size = 4000)
    SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
    FROM [Customers] AS [c]
    WHERE [c].[City] = @__city_0
    ```
    
    Also, this is used to provide a `DebugView` with both the nicely printed expression:
    
    and the generated SQL:
    ajcvickers committed Dec 15, 2019
    Configuration menu
    Copy the full SHA
    5bef3ea View commit details
    Browse the repository at this point in the history