Skip to content

Commit

Permalink
Query: Log query execution plan
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Jun 13, 2019
1 parent 82df078 commit d519f14
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices()
TryAdd<IRelationalValueBufferFactoryFactory, TypedRelationalValueBufferFactoryFactory>();
TryAdd<IDatabaseCreator>(p => p.GetService<IRelationalDatabaseCreator>());
TryAdd<IDbContextTransactionManager>(p => p.GetService<IRelationalConnection>());
TryAdd<IExpressionPrinter, RelationalExpressionPrinter>();
TryAdd<IQueryContextFactory, RelationalQueryContextFactory>();
TryAdd<ICompiledQueryCacheKeyGenerator, RelationalCompiledQueryCacheKeyGenerator>();
TryAdd<INamedConnectionStringResolver, NamedConnectionStringResolver>();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ private void Print(
ExpressionPrinter expressionPrinter)
{
if (value is IEnumerable enumerable
&& !(value is string))
&& !(value is string)
&& !(value is byte[]))
{
bool first = true;
foreach (var item in enumerable)
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Diagnostics/CoreLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ private static string QueryIterationFailed(EventDefinitionBase definition, Event
/// <param name="queryExecutorExpression"> The query expression tree. </param>
public static void QueryExecutionPlanned(
[NotNull] this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics,
[NotNull] IExpressionPrinter expressionPrinter,
[NotNull] ExpressionPrinter expressionPrinter,
[NotNull] Expression queryExecutorExpression)
{
var definition = CoreResources.LogQueryExecutionPlanned(diagnostics);
Expand Down
8 changes: 4 additions & 4 deletions src/EFCore/Diagnostics/QueryExpressionEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class QueryExpressionEventData : EventData
/// <param name="eventDefinition"> The event definition. </param>
/// <param name="messageGenerator"> A delegate that generates a log message for this event. </param>
/// <param name="queryExpression"> The <see cref="Expression" />. </param>
/// <param name="expressionPrinter"> An <see cref="IExpressionPrinter" /> that can be used to render the <see cref="Expression" />. </param>
/// <param name="expressionPrinter"> An <see cref="ExpressionPrinter" /> that can be used to render the <see cref="Expression" />. </param>
public QueryExpressionEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] Expression queryExpression,
[NotNull] IExpressionPrinter expressionPrinter)
[NotNull] ExpressionPrinter expressionPrinter)
: base(eventDefinition, messageGenerator)
{
Expression = queryExpression;
Expand All @@ -39,8 +39,8 @@ public QueryExpressionEventData(
public virtual Expression Expression { get; }

/// <summary>
/// An <see cref="IExpressionPrinter" /> that can be used to render the <see cref="Expression" />.
/// An <see cref="ExpressionPrinter" /> that can be used to render the <see cref="Expression" />.
/// </summary>
public virtual IExpressionPrinter ExpressionPrinter { get; }
public virtual ExpressionPrinter ExpressionPrinter { get; }
}
}
2 changes: 0 additions & 2 deletions src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public static readonly IDictionary<Type, ServiceCharacteristics> CoreServices
{ typeof(IChangeDetector), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IDbContextServices), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IValueGeneratorSelector), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IExpressionPrinter), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IExecutionStrategyFactory), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IAsyncQueryProvider), new ServiceCharacteristics(ServiceLifetime.Scoped) },
{ typeof(IQueryCompiler), new ServiceCharacteristics(ServiceLifetime.Scoped) },
Expand Down Expand Up @@ -234,7 +233,6 @@ public virtual EntityFrameworkServicesBuilder TryAddCoreServices()
TryAdd<ICompiledQueryCache, CompiledQueryCache>();
TryAdd<IAsyncQueryProvider, EntityQueryProvider>();
TryAdd<IQueryCompiler, QueryCompiler>();
TryAdd<IExpressionPrinter, ExpressionPrinter>();
TryAdd<ICompiledQueryCacheKeyGenerator, CompiledQueryCacheKeyGenerator>();
TryAdd<ISingletonOptionsInitializer, SingletonOptionsInitializer>();
TryAdd(typeof(IDiagnosticsLogger<>), typeof(DiagnosticsLogger<>));
Expand Down
Loading

0 comments on commit d519f14

Please sign in to comment.