-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tracing support for EntityFramework 6 (.NET Framework) (#171)
* Added support for EntityFramework 6 for .NET framework.
- Loading branch information
1 parent
ff3648d
commit 2a1891a
Showing
12 changed files
with
620 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
sdk/src/Handlers/EntityFramework/AWSXRayEntityFramework6.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="AWSXRayEntityFramework6.cs" company="Amazon.com"> | ||
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
// A copy of the License is located at | ||
// | ||
// http://aws.amazon.com/apache2.0 | ||
// | ||
// or in the "license" file accompanying this file. This file is distributed | ||
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
// express or implied. See the License for the specific language governing | ||
// permissions and limitations under the License. | ||
// </copyright> | ||
//----------------------------------------------------------------------------- | ||
|
||
using System.Data.Entity.Infrastructure.Interception; | ||
|
||
namespace Amazon.XRay.Recorder.Handlers.EntityFramework | ||
{ | ||
/// <summary> | ||
/// Class for <see cref="DbInterception"/> to add <see cref="EFInterceptor"/>. | ||
/// User can pass collectSqlQueries to AddXRayInterceptor() to decide if sanitized_query should be included in the trace | ||
/// context or not. | ||
/// </summary> | ||
public static class AWSXRayEntityFramework6 | ||
{ | ||
/// <summary> | ||
/// Enable tracing SQL queries through EntityFramework 6 for .NET framework by calling AWSXRayEntityFramework6.AddXRayInterceptor() to add <see cref="EFInterceptor"/> into <see cref="DbInterception"/> to register X-Ray tracing interceptor. | ||
/// </summary> | ||
/// <param name="collectSqlQueries">Set this parameter to true to capture sql query text. The value set here overrides the value of CollectSqlQueries in Web.config if present. The default value of this parameter is null.</param> | ||
public static void AddXRayInterceptor(bool? collectSqlQueries = null) | ||
{ | ||
DbInterception.Add(new EFInterceptor(collectSqlQueries)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.