# No SQL/EF information

**URL:** <https://discuss.elastic.co/t/no-sql-ef-information/234749>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [May 28, 2020, 1:05pm UTC](https://discuss.elastic.co/t/no-sql-ef-information/234749 "2020-05-28T13:05:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![poserdonut](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poserdonut/32/62693_2.png) [@poserdonut](https://discuss.elastic.co/u/poserdonut)\
**Post date:** [May 28, 2020, 1:05pm UTC](https://discuss.elastic.co/t/no-sql-ef-information/234749/1 "2020-05-28T13:05:27Z")

</div>

**APM Agent language and version** :  
C#, 1.5.1

Hi!

I'm trying to setup APM logging in a .NET Framework 4.8 application.  
I'm getting some logging however the SQL and/or EF instrumentation doesn't seem to work.

I have added the elasticapm module in the web.config

```
 <system.webServer>
<modules>
  <remove name="ElasticApmModule"/>
  <add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" preCondition="managedHandler"/>
</modules>
<handlers>
  <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
  <remove name="OPTIONSVerbHandler"/>
  <remove name="TRACEVerbHandler"/>
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>

```

\</system.webServer\>

And I have added the EF interceptor

```
  <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="mssqllocaldb"/>
  </parameters>
</defaultConnectionFactory>
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
<interceptors>
  <interceptor type="Elastic.Apm.EntityFramework6.Ef6Interceptor, Elastic.Apm.EntityFramework6"/>
</interceptors>

```

And in global.asax I'm adding the SQL diagnostic subscriber

```
        protected void Application_Start()
    {
  
        GlobalConfiguration.Configure(WebApiConfig.Register);

        if (Agent.IsConfigured)
        {
            Agent.Subscribe(new SqlClientDiagnosticSubscriber());
        }
    }

```

However the spans doesn't contain any SQL information.

Am I missing some configuration?

---

<div class="post-metadata">

**Author:** ![poserdonut](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poserdonut/32/62693_2.png) [@poserdonut](https://discuss.elastic.co/u/poserdonut)\
**Post date:** [May 29, 2020, 6:38am UTC](https://discuss.elastic.co/t/no-sql-ef-information/234749/3 "2020-05-29T06:38:47Z")

</div>

It seems the EF stuff is getting picked up but the code that uses a SQL Connection with dapper isn't showing up.

E.g.

```auto
        using (IDbConnection connection = new SqlConnection(_connectionStringInsurance))
            {
                list = connection
                    .Query<ArbetsgivareInfoContract>(
                        @"SELECT distinct Person.Id, Name Namn
                          FROM Person
            }

```

However, the EF SQL stuff seems to show up twice. So is the entityframework and SQL diagnostics overlapping but yet the SQL diagnostics not working for the dapper code?

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [June 3, 2020, 9:26pm UTC](https://discuss.elastic.co/t/no-sql-ef-information/234749/4 "2020-06-03T21:26:22Z")

</div>

Hi @poserdonut,

we haven't tested `SqlConnection` with dapper, but I think it should not really make a difference, we capture DiagnosticSource or EventListener directly from `System.Data.*` or `Microsoft.Data.*` so our SqlClient auto instrumentation described [here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup.html#setup-sqlclient) should work.

I think the easiest way to figure out what's going on would be to take a look at the agent logs. Could you maybe try to collect logs and paste them here? [Here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/_collecting_agent_logs.html) is a doc on how to do it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 24, 2020, 5:26pm UTC](https://discuss.elastic.co/t/no-sql-ef-information/234749/5 "2020-06-24T17:26:29Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
