示例#1
0
        /// <summary>
        ///     Creates a new instance with all options the same as for this instance, but with the given option changed.
        ///     It is unusual to call this method directly. Instead use <see cref="DbContextOptionsBuilder" />.
        /// </summary>
        /// <param name="contextLogger"> The option to change. </param>
        /// <returns> A new instance with the option changed. </returns>
        public virtual CoreOptionsExtension WithDbContextLogger([CanBeNull] IDbContextLogger contextLogger)
        {
            var clone = Clone();

            clone._contextLogger = contextLogger;

            return(clone);
        }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public RelationalConnectionDiagnosticsLogger(
     ILoggerFactory loggerFactory,
     ILoggingOptions loggingOptions,
     DiagnosticSource diagnosticSource,
     LoggingDefinitions loggingDefinitions,
     IDbContextLogger contextLogger,
     IDbContextOptions contextOptions,
     IInterceptors?interceptors = null)
     : base(loggerFactory, loggingOptions, diagnosticSource, loggingDefinitions, contextLogger, interceptors)
 {
     _loggingConfigCacheTime = contextOptions.FindExtension <CoreOptionsExtension>()?.LoggingConfigCacheTime ??
                               CoreOptionsExtension.DefaultLoggingConfigCacheTime;
 }
示例#3
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public DiagnosticsLogger(
     ILoggerFactory loggerFactory,
     ILoggingOptions loggingOptions,
     DiagnosticSource diagnosticSource,
     LoggingDefinitions loggingDefinitions,
     IDbContextLogger contextLogger,
     IInterceptors?interceptors = null)
 {
     DiagnosticSource = diagnosticSource;
     Definitions      = loggingDefinitions;
     DbContextLogger  = contextLogger;
     Logger           = loggerFactory.CreateLogger(new TLoggerCategory());
     Options          = loggingOptions;
     Interceptors     = interceptors;
 }
示例#4
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public DiagnosticsLogger(
     [NotNull] ILoggerFactory loggerFactory,
     [NotNull] ILoggingOptions loggingOptions,
     [NotNull] DiagnosticSource diagnosticSource,
     [NotNull] LoggingDefinitions loggingDefinitions,
     [NotNull] IDbContextLogger contextLogger,
     [CanBeNull] IInterceptors interceptors = null)
 {
     DiagnosticSource = diagnosticSource;
     Definitions      = loggingDefinitions;
     DbContextLogger  = contextLogger;
     Logger           = loggerFactory.CreateLogger(new TLoggerCategory());
     Options          = loggingOptions;
     Interceptors     = interceptors;
 }
示例#5
0
    /// <summary>
    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
    ///     any release. You should only use it directly in your code with extreme caution and knowing that
    ///     doing so can result in application failures when updating to a new Entity Framework Core release.
    /// </summary>
    public RelationalCommandDiagnosticsLogger(
        ILoggerFactory loggerFactory,
        ILoggingOptions loggingOptions,
        DiagnosticSource diagnosticSource,
        LoggingDefinitions loggingDefinitions,
        IDbContextLogger contextLogger,
        IDbContextOptions contextOptions,
        IInterceptors?interceptors = null)
        : base(loggerFactory, loggingOptions, diagnosticSource, loggingDefinitions, contextLogger, interceptors)
    {
        var coreOptionsExtension =
            contextOptions.FindExtension <CoreOptionsExtension>()
            ?? new CoreOptionsExtension();

        _loggingCacheTime = coreOptionsExtension.LoggingCacheTime;
    }
示例#6
0
        /// <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;
            _contextLogger = copyFrom.DbContextLogger;
            _memoryCache   = copyFrom.MemoryCache;
            _sensitiveDataLoggingEnabled = copyFrom.IsSensitiveDataLoggingEnabled;
            _detailedErrorsEnabled       = copyFrom.DetailedErrorsEnabled;
            _warningsConfiguration       = copyFrom.WarningsConfiguration;
            _queryTrackingBehavior       = copyFrom.QueryTrackingBehavior;
            _maxPoolSize = copyFrom.MaxPoolSize;
            _serviceProviderCachingEnabled = copyFrom.ServiceProviderCachingEnabled;
            _interceptors = copyFrom.Interceptors?.ToList();

            if (copyFrom._replacedServices != null)
            {
                _replacedServices = new Dictionary <Type, Type>(copyFrom._replacedServices);
            }
        }
 private DbContextOptionsBuilder LogTo([NotNull] IDbContextLogger logger)
 => WithOption(e => e.WithDbContextLogger(logger));