/// <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="warningsConfiguration"> The option to change. </param>
        /// <returns> A new instance with the option changed. </returns>
        public virtual CoreOptionsExtension WithWarningsConfiguration([CanBeNull] WarningsConfiguration warningsConfiguration)
        {
            var clone = Clone();

            clone._warningsConfiguration = warningsConfiguration;

            return(clone);
        }
        /// <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);
            }
        }
Esempio n. 3
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 WarningsConfiguration([NotNull] WarningsConfiguration copyFrom)
 {
     _defaultBehavior   = copyFrom._defaultBehavior;
     _explicitBehaviors = copyFrom._explicitBehaviors;
 }
Esempio n. 4
0
 /// <summary>
 ///     <para>
 ///         Initializes a new instance of the <see cref="WarningsConfigurationBuilder" /> class.
 ///     </para>
 ///     <para>
 ///         This class is used within the <see cref="DbContextOptionsBuilder.ConfigureWarnings(System.Action{WarningsConfigurationBuilder})" />
 ///         API and it is not designed to be directly constructed in your application code.
 ///     </para>
 /// </summary>
 /// <param name="warningsConfiguration"> The internal object used to store configuration. </param>
 public WarningsConfigurationBuilder([CanBeNull] WarningsConfiguration warningsConfiguration)
 {
     Configuration = warningsConfiguration ?? new WarningsConfiguration();
 }