/// <summary> /// Adds default <see cref="WarningBehavior" /> for relational events. /// </summary> /// <param name="coreOptionsExtension">The core options extension.</param> /// <returns>The new core options extension.</returns> public static CoreOptionsExtension WithDefaultWarningConfiguration(CoreOptionsExtension coreOptionsExtension) => coreOptionsExtension.WithWarningsConfiguration( coreOptionsExtension.WarningsConfiguration .TryWithExplicit(RelationalEventId.AmbientTransactionWarning, WarningBehavior.Throw) .TryWithExplicit(RelationalEventId.IndexPropertiesBothMappedAndNotMappedToTable, WarningBehavior.Throw) .TryWithExplicit(RelationalEventId.IndexPropertiesMappedToNonOverlappingTables, WarningBehavior.Throw) .TryWithExplicit(RelationalEventId.ForeignKeyPropertiesMappedToUnrelatedTables, WarningBehavior.Throw));
public SensitiveDataLogger( [NotNull] ILogger <T> logger, [CanBeNull] IDbContextOptions contextOptions) { _logger = logger; _coreOptionsExtension = contextOptions?.Extensions .OfType <CoreOptionsExtension>() .FirstOrDefault(); }
/// <summary> /// Initializes a new instance of the <see cref="SensitiveDataLogger{T}" /> class. /// </summary> /// <param name="dependencies"> Parameter object containing dependencies for this service. </param> public SensitiveDataLogger( [NotNull] SensitiveDataLoggerDependencies <T> dependencies) { Check.NotNull(dependencies, nameof(dependencies)); Dependencies = dependencies; _logger = dependencies.Logger; _coreOptionsExtension = dependencies.ContextOptions?.Extensions .OfType <CoreOptionsExtension>() .FirstOrDefault(); }
/// <summary> /// Called by a derived class constructor when implementing the <see cref="Clone" /> method. /// </summary> /// <param name="copyFrom"> The instance that is being cloned. </param> protected CoreOptionsExtension([NotNull] CoreOptionsExtension copyFrom) { _internalServiceProvider = copyFrom.InternalServiceProvider; _applicationServiceProvider = copyFrom.ApplicationServiceProvider; _model = copyFrom.Model; _loggerFactory = copyFrom.LoggerFactory; _memoryCache = copyFrom.MemoryCache; _sensitiveDataLoggingEnabled = copyFrom.IsSensitiveDataLoggingEnabled; _warningsConfiguration = copyFrom.WarningsConfiguration; _queryTrackingBehavior = copyFrom.QueryTrackingBehavior; _maxPoolSize = copyFrom.MaxPoolSize; if (copyFrom._replacedServices != null) { _replacedServices = new Dictionary <Type, Type>(copyFrom._replacedServices); } }
public ExtensionInfo(CoreOptionsExtension extension) : base(extension) { }