IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Entity Framework 6
editEntity Framework 6
editQuick start
editYou can enable auto instrumentation for Entity Framework 6 by referencing the Elastic.Apm.EntityFramework6
package
and including the Ef6Interceptor
interceptor in your application’s web.config
:
<?xml version="1.0" encoding="utf-8"?> <configuration> <entityFramework> <interceptors> <interceptor type="Elastic.Apm.EntityFramework6.Ef6Interceptor, Elastic.Apm.EntityFramework6" /> </interceptors> </entityFramework> </configuration>
As an alternative to registering the interceptor via the configuration, you can register it in the application code:
DbInterception.Add(new Elastic.Apm.EntityFramework6.Ef6Interceptor());
For example, in an ASP.NET MVC application, you can place the above call in the Application_Start
method.
Be careful not to execute DbInterception.Add
for the same interceptor more than once,
or you’ll get additional interceptor instances.
For example, if you add Ef6Interceptor
interceptor twice, you’ll see two spans for every SQL query.