/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public CoreOptionsExtension([NotNull] CoreOptionsExtension copyFrom) { _internalServiceProvider = copyFrom.InternalServiceProvider; _model = copyFrom.Model; _loggerFactory = copyFrom.LoggerFactory; _memoryCache = copyFrom.MemoryCache; _isSensitiveDataLoggingEnabled = copyFrom.IsSensitiveDataLoggingEnabled; _warningsConfiguration = copyFrom.WarningsConfiguration; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public DiagnosticsLogger( [NotNull] ILoggerFactory loggerFactory, [CanBeNull] ILoggingOptions loggingOptions, [NotNull] DiagnosticSource diagnosticSource) { DiagnosticSource = diagnosticSource; Logger = loggerFactory.CreateLogger(new TLoggerCategory()); Options = loggingOptions; _warningsConfiguration = loggingOptions?.WarningsConfiguration; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public InterceptingLogger( [NotNull] IDbContextServices contextServices, [NotNull] IServiceProvider serviceProvider, [CanBeNull] IDbContextOptions contextOptions) { _logger = (contextServices.LoggerFactory ?? serviceProvider.GetRequiredService <ILoggerFactory>()) .CreateLogger(_name); _warningsConfiguration = contextOptions ?.FindExtension <CoreOptionsExtension>() ?.WarningsConfiguration; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public CoreOptionsExtension([NotNull] CoreOptionsExtension copyFrom) { _internalServiceProvider = copyFrom.InternalServiceProvider; _model = copyFrom.Model; _loggerFactory = copyFrom.LoggerFactory; _memoryCache = copyFrom.MemoryCache; _isSensitiveDataLoggingEnabled = copyFrom.IsSensitiveDataLoggingEnabled; _warningsConfiguration = copyFrom.WarningsConfiguration; _queryTrackingBehavior = copyFrom.QueryTrackingBehavior; if (copyFrom._replacedServices != null) { _replacedServices = new Dictionary <Type, Type>(copyFrom._replacedServices); } }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual void Validate(IDbContextOptions options) { var coreOptions = options.FindExtension <CoreOptionsExtension>() ?? new CoreOptionsExtension(); if (IsSensitiveDataLoggingEnabled != coreOptions.IsSensitiveDataLoggingEnabled) { Debug.Assert(coreOptions.InternalServiceProvider != null); throw new InvalidOperationException( CoreStrings.SingletonOptionChanged( nameof(DbContextOptionsBuilder.EnableSensitiveDataLogging), nameof(DbContextOptionsBuilder.UseInternalServiceProvider))); } if (WarningsConfiguration?.GetServiceProviderHashCode() != coreOptions.WarningsConfiguration?.GetServiceProviderHashCode()) { Debug.Assert(coreOptions.InternalServiceProvider != null); throw new InvalidOperationException( CoreStrings.SingletonOptionChanged( nameof(DbContextOptionsBuilder.ConfigureWarnings), nameof(DbContextOptionsBuilder.UseInternalServiceProvider))); } }