/// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        public CoreConventionSetBuilderDependencies(
            [NotNull] ICoreTypeMapper typeMapper,
            [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
            [CanBeNull] IParameterBindingFactories parameterBindingFactories,
            [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
            [CanBeNull] ITypeMapper _ = null) // Only needed for D.I. to resolve this constructor
        {
            Check.NotNull(typeMapper, nameof(typeMapper));

            TypeMapper = typeMapper;

            if (parameterBindingFactories == null)
            {
                parameterBindingFactories = new ParameterBindingFactories(
                    null,
                    new RegisteredServices(Enumerable.Empty <Type>()));
            }

            ParameterBindingFactories = parameterBindingFactories;

            ConstructorBindingFactory = constructorBindingFactory
                                        ?? new ConstructorBindingFactory(
                new PropertyParameterBindingFactory(),
                parameterBindingFactories);

            Logger = logger
                     ?? new DiagnosticsLogger <DbLoggerCategory.Model>(new LoggerFactory(), new LoggingOptions(), new DiagnosticListener(""));
        }
        public ProviderConventionSetBuilderDependencies(
            [NotNull] ITypeMappingSource typeMappingSource,
            [NotNull] IConstructorBindingFactory constructorBindingFactory,
            [NotNull] IParameterBindingFactories parameterBindingFactories,
            [NotNull] IMemberClassifier memberClassifier,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model.Validation> validationLogger,
            [NotNull] IDbSetFinder setFinder,
            [NotNull] ICurrentDbContext currentContext,
            [NotNull] IModelValidator validator)
        {
            Check.NotNull(typeMappingSource, nameof(typeMappingSource));
            Check.NotNull(constructorBindingFactory, nameof(constructorBindingFactory));
            Check.NotNull(parameterBindingFactories, nameof(parameterBindingFactories));
            Check.NotNull(memberClassifier, nameof(memberClassifier));
            Check.NotNull(logger, nameof(logger));
            Check.NotNull(validationLogger, nameof(validationLogger));
            Check.NotNull(setFinder, nameof(setFinder));
            Check.NotNull(validator, nameof(validator));

            TypeMappingSource         = typeMappingSource;
            ParameterBindingFactories = parameterBindingFactories;
            MemberClassifier          = memberClassifier;
            ConstructorBindingFactory = constructorBindingFactory;
            Logger           = logger;
            ValidationLogger = validationLogger;
            SetFinder        = setFinder;
            _currentContext  = currentContext;
            ModelValidator   = validator;
        }
Example #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 ConstructorBindingConvention(
     [NotNull] IConstructorBindingFactory bindingFactory,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger)
 {
     _bindingFactory = bindingFactory;
     Logger          = logger;
 }
Example #4
0
 /// <summary>
 ///     <para>
 ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
 ///     </para>
 ///     <para>
 ///         Do not call this constructor directly from either provider or application code as it may change
 ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
 ///         will be created and injected automatically by the dependency injection container. To create
 ///         an instance with some dependent services replaced, first resolve the object from the dependency
 ///         injection container, then replace selected services using the 'With...' methods. Do not call
 ///         the constructor at any point in this process.
 ///     </para>
 ///     <para>
 ///         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.
 ///     </para>
 /// </summary>
 public CoreConventionSetBuilderDependencies(
     [NotNull] ITypeMapper typeMapper,
     [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
     [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger)
     : this(logger, constructorBindingFactory, typeMapper)
 {
     Check.NotNull(typeMapper, nameof(typeMapper));
 }
 /// <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 ProxyBindingRewriter(
     [NotNull] IProxyFactory proxyFactory,
     [NotNull] IConstructorBindingFactory bindingFactory,
     [CanBeNull] ProxiesOptionsExtension options)
 {
     _directBindingConvention = new ConstructorBindingConvention(bindingFactory);
     _proxyFactory            = proxyFactory;
     _options = options;
 }
 /// <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 ProxiesConventionSetBuilder(
     [NotNull] IDbContextOptions options,
     [NotNull] IConstructorBindingFactory constructorBindingFactory,
     [NotNull] IProxyFactory proxyFactory)
 {
     _options = options;
     _constructorBindingFactory = constructorBindingFactory;
     _proxyFactory = proxyFactory;
 }
 /// <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 ProxyBindingRewriter(
     [NotNull] IProxyFactory proxyFactory,
     [NotNull] IConstructorBindingFactory bindingFactory,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
     [CanBeNull] ProxiesOptionsExtension options)
 {
     _directBindingConvention = new ConstructorBindingConvention(bindingFactory, logger);
     _proxyFactory            = proxyFactory;
     _options = options;
 }
        /// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        public CoreConventionSetBuilderDependencies(
            [NotNull] ITypeMapper typeMapper,
            [NotNull] IConstructorBindingFactory constructorBindingFactory)
        {
            Check.NotNull(typeMapper, nameof(typeMapper));
            Check.NotNull(constructorBindingFactory, nameof(constructorBindingFactory));

            TypeMapper = typeMapper;
            ConstructorBindingFactory = constructorBindingFactory;
        }
Example #9
0
 private CoreConventionSetBuilderDependencies(
     IDiagnosticsLogger <DbLoggerCategory.Model> logger,
     IConstructorBindingFactory constructorBindingFactory,
     ITypeMapper typeMapper)
 {
     TypeMapper = typeMapper;
     ConstructorBindingFactory = constructorBindingFactory ?? new ConstructorBindingFactory();
     Logger = logger
              ?? new DiagnosticsLogger <DbLoggerCategory.Model>(new LoggerFactory(), new LoggingOptions(), new DiagnosticListener(""));
 }
 /// <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 ProxiesConventionSetCustomizer(
     [NotNull] IDbContextOptions options,
     [NotNull] IConstructorBindingFactory constructorBindingFactory,
     [NotNull] IProxyFactory proxyFactory,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger)
 {
     _options = options;
     _constructorBindingFactory = constructorBindingFactory;
     _proxyFactory = proxyFactory;
     _logger       = logger;
 }
Example #11
0
        /// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        public CoreConventionSetBuilderDependencies(
            [NotNull] ICoreTypeMapper typeMapper,
            [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
            [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
            [CanBeNull] ITypeMapper _ = null) // Only needed for D.I. to resolve this constructor
        {
            Check.NotNull(typeMapper, nameof(typeMapper));

            TypeMapper = typeMapper;
            ConstructorBindingFactory = constructorBindingFactory ?? new ConstructorBindingFactory();
            Logger = logger
                     ?? new DiagnosticsLogger <DbLoggerCategory.Model>(new LoggerFactory(), new LoggingOptions(), new DiagnosticListener(""));
        }
Example #12
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 ProxiesConventionSetCustomizer(
     [NotNull] IDbContextOptions options,
     [NotNull] IConstructorBindingFactory constructorBindingFactory,
     [NotNull] IProxyFactory proxyFactory,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
     [NotNull] LazyLoaderParameterBindingFactoryDependencies lazyLoaderParameterBindingFactoryDependencies)
 {
     _options = options;
     _constructorBindingFactory = constructorBindingFactory;
     _proxyFactory = proxyFactory;
     _logger       = logger;
     _lazyLoaderParameterBindingFactoryDependencies = lazyLoaderParameterBindingFactoryDependencies;
 }
        /// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="ProviderConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        /// <param name="typeMappingSource"> The type mapping source. </param>
        /// <param name="constructorBindingFactory"> The constructor binding factory. </param>
        /// <param name="parameterBindingFactories"> The parameter binding factories. </param>
        /// <param name="memberClassifier"> The member classifier. </param>
        /// <param name="logger"> The model logger. </param>
        /// <param name="setFinder"> The set finder. </param>
        /// <param name="context"> The current context instance. </param>
        public ProviderConventionSetBuilderDependencies(
            [NotNull] ITypeMappingSource typeMappingSource,
            [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
            [CanBeNull] IParameterBindingFactories parameterBindingFactories,
            [CanBeNull] IMemberClassifier memberClassifier,
            [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
            [CanBeNull] IDbSetFinder setFinder,
            [CanBeNull] ICurrentDbContext context)
        {
            Check.NotNull(typeMappingSource, nameof(typeMappingSource));

            TypeMappingSource = typeMappingSource;

            if (parameterBindingFactories == null)
            {
                parameterBindingFactories = new ParameterBindingFactories(
                    null,
                    new RegisteredServices(Enumerable.Empty <Type>()));
            }

            ParameterBindingFactories = parameterBindingFactories;

            if (memberClassifier == null)
            {
                memberClassifier = new MemberClassifier(
                    typeMappingSource,
                    parameterBindingFactories);
            }

            MemberClassifier = memberClassifier;

            if (constructorBindingFactory == null)
            {
                ConstructorBindingFactory = new ConstructorBindingFactory(
                    new PropertyParameterBindingFactory(),
                    parameterBindingFactories);
            }

            ConstructorBindingFactory = constructorBindingFactory;

            Logger = logger
                     ?? new DiagnosticsLogger <DbLoggerCategory.Model>(
                new ScopedLoggerFactory(new LoggerFactory(), dispose: true),
                new LoggingOptions(),
                new DiagnosticListener(""),
                new LoggingDefinitions());

            SetFinder = setFinder;
            Context   = context;
        }
Example #14
0
        /// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        public CoreConventionSetBuilderDependencies(
            [NotNull] ITypeMappingSource typeMappingSource,
            [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
            [CanBeNull] IParameterBindingFactories parameterBindingFactories,
            [CanBeNull] IMemberClassifier memberClassifier,
            [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger,
#pragma warning disable 618
            [CanBeNull] ITypeMapper _ = null) // Only needed for D.I. to resolve this constructor
#pragma warning restore 618
        {
            Check.NotNull(typeMappingSource, nameof(typeMappingSource));

            TypeMappingSource = typeMappingSource;

            if (parameterBindingFactories == null)
            {
                parameterBindingFactories = new ParameterBindingFactories(
                    null,
                    new RegisteredServices(Enumerable.Empty <Type>()));
            }

            ParameterBindingFactories = parameterBindingFactories;

            if (memberClassifier == null)
            {
                memberClassifier = new MemberClassifier(
                    typeMappingSource,
                    parameterBindingFactories);
            }

            MemberClassifier = memberClassifier;

            if (constructorBindingFactory == null)
            {
                ConstructorBindingFactory = new ConstructorBindingFactory(
                    new PropertyParameterBindingFactory(),
                    parameterBindingFactories);
            }

            ConstructorBindingFactory = constructorBindingFactory;

            Logger = logger
                     ?? new DiagnosticsLogger <DbLoggerCategory.Model>(new LoggerFactory(), new LoggingOptions(), new DiagnosticListener(""));
        }
Example #15
0
        /// <summary>
        ///     <para>
        ///         Creates the service dependencies parameter object for a <see cref="CoreConventionSetBuilder" />.
        ///     </para>
        ///     <para>
        ///         Do not call this constructor directly from either provider or application code as it may change
        ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
        ///         will be created and injected automatically by the dependency injection container. To create
        ///         an instance with some dependent services replaced, first resolve the object from the dependency
        ///         injection container, then replace selected services using the 'With...' methods. Do not call
        ///         the constructor at any point in this process.
        ///     </para>
        ///     <para>
        ///         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.
        ///     </para>
        /// </summary>
        public CoreConventionSetBuilderDependencies(
            [NotNull] ITypeMappingSource typeMappingSource,
            [CanBeNull] IConstructorBindingFactory constructorBindingFactory,
            [CanBeNull] IParameterBindingFactories parameterBindingFactories,
            [CanBeNull] IMemberClassifier memberClassifier)
        {
            Check.NotNull(typeMappingSource, nameof(typeMappingSource));

            TypeMappingSource = typeMappingSource;

            if (parameterBindingFactories == null)
            {
                parameterBindingFactories = new ParameterBindingFactories(
                    null,
                    new RegisteredServices(Enumerable.Empty <Type>()));
            }

            ParameterBindingFactories = parameterBindingFactories;

            if (memberClassifier == null)
            {
                memberClassifier = new MemberClassifier(
                    typeMappingSource,
                    parameterBindingFactories);
            }

            MemberClassifier = memberClassifier;

            if (constructorBindingFactory == null)
            {
                ConstructorBindingFactory = new ConstructorBindingFactory(
                    new PropertyParameterBindingFactory(),
                    parameterBindingFactories);
            }

            ConstructorBindingFactory = constructorBindingFactory;
        }
Example #16
0
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="constructorBindingFactory"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public CoreConventionSetBuilderDependencies With([NotNull] IConstructorBindingFactory constructorBindingFactory)
 => new CoreConventionSetBuilderDependencies(
     TypeMappingSource, constructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger);
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="constructorBindingFactory"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public CoreConventionSetBuilderDependencies With([NotNull] IConstructorBindingFactory constructorBindingFactory)
 => new CoreConventionSetBuilderDependencies(TypeMapper, constructorBindingFactory, ParameterBindingFactories, Logger);
Example #18
0
 /// <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 ConstructorBindingConvention([NotNull] IConstructorBindingFactory bindingFactory)
 => _bindingFactory = bindingFactory;
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="constructorBindingFactory"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public ProviderConventionSetBuilderDependencies With([NotNull] IConstructorBindingFactory constructorBindingFactory)
 => new ProviderConventionSetBuilderDependencies(
     TypeMappingSource, constructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger,
     SetFinder, _currentContext, ModelValidator);