private static string QueryIterationFailed(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <Type, string, Exception>)definition; var p = (DbContextTypeErrorEventData)payload; return(d.GenerateMessage(p.ContextType, Environment.NewLine, p.Exception)); }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="connection">The <see cref="DbConnection" /> being used.</param> /// <param name="command">The <see cref="DbCommand" />.</param> /// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param> /// <param name="executeMethod">The <see cref="DbCommand" /> method.</param> /// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param> /// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param> /// <param name="async">Indicates whether or not the command was executed asynchronously.</param> /// <param name="logParameterValues">Indicates whether or not the application allows logging of parameter values.</param> /// <param name="startTime">The start time of this event.</param> /// <param name="duration">The duration this event.</param> /// <param name="commandSource">Source of the command.</param> public CommandEndEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, DbConnection connection, DbCommand command, DbContext?context, DbCommandMethod executeMethod, Guid commandId, Guid connectionId, bool async, bool logParameterValues, DateTimeOffset startTime, TimeSpan duration, CommandSource commandSource) : base( eventDefinition, messageGenerator, connection, command, context, executeMethod, commandId, connectionId, async, logParameterValues, startTime, commandSource) { Duration = duration; }
private static string SequenceConfiguredWarning(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string>)definition; var p = (SequenceEventData)payload; return(d.GenerateMessage(p.Sequence.Name)); }
private static string TableRebuildPendingWarning(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string, string?>)definition; var p = (TableRebuildEventData)payload; return(d.GenerateMessage(p.OperationType.ShortDisplayName(), p.TableName)); }
private static string UnexpectedConnectionTypeWarning(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string>)definition; var p = (UnexpectedConnectionTypeEventData)payload; return(d.GenerateMessage(p.ConnectionType.ShortDisplayName())); }
private static string ChangesSaved(EventDefinitionBase definition, EventData payload) { EventDefinition <int> d = (EventDefinition <int>)definition; SaveChangesEventData p = (SaveChangesEventData)payload; return(d.GenerateMessage(p.RowsAffected)); }
private static string QueryModelCompiling(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string, string>)definition; var p = (QueryModelEventData)payload; return(d.GenerateMessage(Environment.NewLine, p.QueryModel.Print())); }
private static string RowLimitingOperationWithoutOrderByWarning(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string>)definition; var p = (QueryModelEventData)payload; return(d.GenerateMessage(p.QueryModel.Print(removeFormatting: true, characterLimit: QueryModelStringLengthLimit))); }
[MethodImpl(MethodImplOptions.AggressiveInlining)] // Because hot path for logging protected bool NeedsEventData <TInterceptor>( EventDefinitionBase definition, out TInterceptor?interceptor, out bool diagnosticSourceEnabled, out bool simpleLogEnabled) where TInterceptor : class, IInterceptor => ((IDiagnosticsLogger)this).NeedsEventData(definition, out interceptor, out diagnosticSourceEnabled, out simpleLogEnabled);
public static void Log(this DbContext dbContext, string msg) { var logger = dbContext.GetService <IDiagnosticsLogger <DbLoggerCategory.Update> >(); EventDefinitionBase eventData = CoreResources.LogQueryExecutionPlanned(logger); logger.DbContextLogger.Log(new EventData(eventData, (s1, s2) => msg)); }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="contextType">The current <see cref="DbContext" />.</param> public DbContextTypeEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, Type contextType) : base(eventDefinition, messageGenerator) { ContextType = contextType; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="serviceProviders">The <see cref="IServiceProvider" />s.</param> public ServiceProvidersEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, ICollection <IServiceProvider> serviceProviders) : base(eventDefinition, messageGenerator) { ServiceProviders = serviceProviders; }
private static string ExecutionStrategyRetrying(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <int, string, Exception>)definition; var p = (ExecutionStrategyEventData)payload; return(d.GenerateMessage( (int)p.Delay.TotalMilliseconds, Environment.NewLine, p.ExceptionsEncountered[p.ExceptionsEncountered.Count - 1])); }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition"> The event definition. </param> /// <param name="messageGenerator"> A delegate that generates a log message for this event. </param> /// <param name="connectionType"> The connection type. </param> public UnexpectedConnectionTypeEventData( [NotNull] EventDefinitionBase eventDefinition, [NotNull] Func <EventDefinitionBase, EventData, string> messageGenerator, [NotNull] Type connectionType) : base(eventDefinition, messageGenerator) { ConnectionType = connectionType; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="expression">The <see cref="Expression" />.</param> public ExpressionEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, Expression expression) : base(eventDefinition, messageGenerator) { Expression = expression; }
private static string TransactionUsed(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition <string>)definition; var p = (TransactionEventData)payload; return(d.GenerateMessage( p.Transaction.IsolationLevel.ToString("G"))); }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="migrator"> /// The <see cref="IMigrator" /> in use. /// </param> public MigratorEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IMigrator migrator) : base(eventDefinition, messageGenerator) { Migrator = migrator; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="foreignKey">The foreign key.</param> public ForeignKeyEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlyForeignKey foreignKey) : base(eventDefinition, messageGenerator) { ForeignKey = foreignKey; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="entityType">The entityType.</param> public EntityTypeEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlyEntityType entityType) : base(eventDefinition, messageGenerator) { EntityType = entityType; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="migrationType">The migration type.</param> public MigrationTypeEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, TypeInfo migrationType) : base(eventDefinition, messageGenerator) { MigrationType = migrationType; }
/// <summary> /// Initializes a new instance of the <see cref="MigrationColumnOperationEventData" /> class. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="columnOperation">The column operation.</param> public MigrationColumnOperationEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, ColumnOperation columnOperation) : base(eventDefinition, messageGenerator) { ColumnOperation = columnOperation; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="sequence">The sequence.</param> public SequenceEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlySequence sequence) : base(eventDefinition, messageGenerator) { Sequence = sequence; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="navigationBase">The navigation base.</param> public NavigationBaseEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlyNavigationBase navigationBase) : base(eventDefinition, messageGenerator) { NavigationBase = navigationBase; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="entityEntry">The entity entry.</param> public EntityEntryEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, EntityEntry entityEntry) : base(eventDefinition, messageGenerator) { EntityEntry = entityEntry; }
/// <summary> /// Constructs the event payload for the <see cref="RelationalEventId.IndexPropertiesMappedToNonOverlappingTables" /> event. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="entityType">The entity type on which the index is defined.</param> /// <param name="indexName">The name of the index.</param> /// <param name="indexPropertyNames">The names of the properties which define the index.</param> /// <param name="property1Name">The name of the first property name which causes this event.</param> /// <param name="tablesMappedToProperty1">The tables mapped to the first property.</param> /// <param name="property2Name">The name of the second property name which causes this event.</param> /// <param name="tablesMappedToProperty2">The tables mapped to the second property.</param> public IndexWithPropertiesEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IEntityType entityType, string?indexName, List <string> indexPropertyNames, string property1Name, List <(string Table, string?Schema)> tablesMappedToProperty1,
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="property">The property.</param> public PropertyEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlyProperty property) : base(eventDefinition, messageGenerator) { Property = property; }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="context">The current <see cref="DbContext" />, or null if not known.</param> public DbContextEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, DbContext?context) : base(eventDefinition, messageGenerator) { Context = context; }
private static string DecimalTypeDefaultWarning(EventDefinitionBase definition, EventData payload) { var d = (EventDefinition<string, string>)definition; var p = (PropertyEventData)payload; return d.GenerateMessage( p.Property.Name, p.Property.DeclaringEntityType.DisplayName()); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="DocumentQueryEvent"/> class. /// </summary> /// <param name="eventDefinition"> The event definition. </param> /// <param name="messageGenerator"> A delegate that generates a log message for this event. </param> /// <param name="documentQuery">A textual representation of the document query.</param> public DocumentQueryEvent( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, string documentQuery) : base(eventDefinition, messageGenerator) { DocumentQuery = Check.NotEmpty(documentQuery, nameof(documentQuery)); }
/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition">The event definition.</param> /// <param name="messageGenerator">A delegate that generates a log message for this event.</param> /// <param name="navigation">The navigation.</param> public SkipNavigationEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlySkipNavigation navigation) : base(eventDefinition, messageGenerator) { Navigation = navigation; }