Data FAQ

How to get SQL to LINQ verbose logging

How can I see what SQL quries get executed when I write my own LINQ quries in C# using the C1 Data API?

Answer:

This requires that your site is already running on SQL.

  1. Edit your ~/App_Data/Composite/Composite.config
  2. Locate the following XML elements:
    <Composite.Data.Plugins.DataProviderConfiguration 
      defaultDynamicTypeDataProviderName="DynamicSqlDataProvider">
      <DataProviderPlugins>
        <add name="DynamicSqlDataProvider" 
             connectionString="YOUR CONNECTION STRING" sqlQueryLoggingEnabled="false" 
             sqlQueryLoggingIncludeStack="false" 
             type="Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.SqlDataProvider, Composite" />
        <!-- More elements here, but not needed in this FAQ -->
      </DataProviderPlugins>
    </Composite.Data.Plugins.DataProviderConfiguration>
  3. Change the attribute 'sqlQueryLoggingEnabled' to 'true'.
  4. Optionally add the following:
    <Composite.Data.Plugins.DataProviderConfiguration 
      defaultDynamicTypeDataProviderName="DynamicSqlDataProvider">
      <DataProviderPlugins>
        <add name="DynamicSqlDataProvider" connectionString="YOUR CONNECTION STRING" 
             sqlQueryLoggingEnabled="true" sqlQueryLoggingIncludeStack="false" 
             type="Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.SqlDataProvider, Composite">
          <LoggingIgnoreInterfaces>
            <add interfaceType="Composite.Data.Types.IUserConsoleInformation" />
          </LoggingIgnoreInterfaces>
        </add>
        <!-- More elements here, but not needed in this FAQ -->
      </DataProviderPlugins>
    </Composite.Data.Plugins.DataProviderConfiguration>
There is a lot of requests to the interface 'Composite.Data.Types.IUserConsoleInformation' and if caching is not enabled this could be a little too verbose.