/// <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 RelationalParameterBuilder( [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(typeMapper, nameof(typeMapper)); TypeMapper = typeMapper; }
public TestRelationalCommandBuilder( IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, IRelationalCoreTypeMapper typeMapper) { _logger = logger; ParameterBuilder = new RelationalParameterBuilder(typeMapper); }
public TestRelationalCommandBuilderFactory( IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, IRelationalCoreTypeMapper typeMapper) { _logger = logger; _typeMapper = typeMapper; }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="IRelationalValueBufferFactory" /> /// implementations. /// </para> /// <para> /// This type is typically used by database providers (and other extensions). It is generally /// not used in application code. /// </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> /// </summary> /// <param name="typeMapper"> The type mapper. </param> public RelationalValueBufferFactoryDependencies( [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(typeMapper, nameof(typeMapper)); TypeMapper = typeMapper; }
public OracleUpdateSqlGenerator( [NotNull] UpdateSqlGeneratorDependencies dependencies, [NotNull] IRelationalCoreTypeMapper typeMapper) : base(dependencies) { _typeMapper = typeMapper; }
public BadDataRelationalCommandBuilder( IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, IRelationalCoreTypeMapper typeMapper, object[] values) : base(logger, typeMapper) { _values = values; }
/// <summary> /// Gets the relational database type for a given object, throwing if no mapping is found. /// </summary> /// <param name="typeMapper"> The type mapper. </param> /// <param name="value"> The object to get the mapping for. </param> /// <returns> The type mapping to be used. </returns> public static RelationalTypeMapping GetMappingForValue( [CanBeNull] this IRelationalCoreTypeMapper typeMapper, [CanBeNull] object value) => value == null || value == DBNull.Value || typeMapper == null ? RelationalTypeMapping.NullMapping : typeMapper.FindMapping(value.GetType());
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="coreTypeMapper"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public QuerySqlGeneratorDependencies With([NotNull] IRelationalCoreTypeMapper coreTypeMapper) => new QuerySqlGeneratorDependencies( CommandBuilderFactory, SqlGenerationHelper, ParameterNameGeneratorFactory, #pragma warning disable 618 RelationalTypeMapper, #pragma warning restore 618 coreTypeMapper);
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="coreTypeMapper"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public SqlTranslatingExpressionVisitorDependencies With([NotNull] IRelationalCoreTypeMapper coreTypeMapper) => new SqlTranslatingExpressionVisitorDependencies( CompositeExpressionFragmentTranslator, MethodCallTranslator, MemberTranslator, #pragma warning disable 618 RelationalTypeMapper, #pragma warning restore 618 coreTypeMapper);
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="coreTypeMapper"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public MigrationsSqlGeneratorDependencies With([NotNull] IRelationalCoreTypeMapper coreTypeMapper) => new MigrationsSqlGeneratorDependencies( CommandBuilderFactory, UpdateSqlGenerator, SqlGenerationHelper, #pragma warning disable 618 TypeMapper, #pragma warning restore 618 coreTypeMapper);
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="UpdateSqlGenerator" />. /// </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> /// <param name="sqlGenerationHelper"> Helpers for generating update SQL. </param> /// <param name="coreTypeMapper"> The type mapper. </param> public UpdateSqlGeneratorDependencies( [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IRelationalCoreTypeMapper coreTypeMapper) { Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); SqlGenerationHelper = sqlGenerationHelper; CoreTypeMapper = coreTypeMapper; }
/// <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 RelationalCommandBuilder( [NotNull] IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(logger, nameof(logger)); Check.NotNull(typeMapper, nameof(typeMapper)); _logger = logger; ParameterBuilder = new RelationalParameterBuilder(typeMapper); }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="SelectExpression" />. /// </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> /// </summary> /// <param name="querySqlGeneratorFactory"> The query SQL generator factory. </param> /// <param name="typeMapper"> The type mapper. </param> public SelectExpressionDependencies( [NotNull] IQuerySqlGeneratorFactory querySqlGeneratorFactory, [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(querySqlGeneratorFactory, nameof(querySqlGeneratorFactory)); Check.NotNull(typeMapper, nameof(typeMapper)); QuerySqlGeneratorFactory = querySqlGeneratorFactory; TypeMapper = 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 RelationalCommandBuilderFactory( [NotNull] IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(logger, nameof(logger)); Check.NotNull(typeMapper, nameof(typeMapper)); _logger = logger; _typeMapper = 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 SqliteDatabaseModelFactory( [NotNull] IDiagnosticsLogger <DbLoggerCategory.Scaffolding> logger, [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(logger, nameof(logger)); Check.NotNull(typeMapper, nameof(typeMapper)); _logger = logger; _typeMapper = typeMapper; }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="RelationalModelValidator" />. /// </para> /// <para> /// This type is typically used by database providers (and other extensions). It is generally /// not used in application code. /// </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> /// </summary> /// <param name="typeMapper"> The type mapper. </param> /// <param name="coreTypeMapper"> The type mapper. </param> public RelationalModelValidatorDependencies( [NotNull] IRelationalTypeMapper typeMapper, [NotNull] IRelationalCoreTypeMapper coreTypeMapper) { Check.NotNull(typeMapper, nameof(typeMapper)); Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); #pragma warning disable 618 TypeMapper = typeMapper; #pragma warning restore 618 CoreTypeMapper = coreTypeMapper; }
/// <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 DynamicRelationalParameter( [NotNull] string invariantName, [NotNull] string name, [NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotEmpty(invariantName, nameof(invariantName)); Check.NotEmpty(name, nameof(name)); Check.NotNull(typeMapper, nameof(typeMapper)); InvariantName = invariantName; Name = name; _typeMapper = typeMapper; }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="RelationalConventionSetBuilder" />. /// </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 RelationalConventionSetBuilderDependencies( [NotNull] IRelationalCoreTypeMapper coreTypeMapper, [CanBeNull] IDiagnosticsLogger <DbLoggerCategory.Model> logger, [CanBeNull] ICurrentDbContext currentContext, [CanBeNull] IDbSetFinder setFinder, [CanBeNull] IRelationalTypeMapper _ = null) // Only needed for D.I. to resolve this constructor { Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); CoreTypeMapper = coreTypeMapper; Logger = logger ?? new DiagnosticsLogger <DbLoggerCategory.Model>(new LoggerFactory(), new LoggingOptions(), new DiagnosticListener("")); Context = currentContext; SetFinder = setFinder; }
/// <summary> /// <para> /// Gets the mapping that represents the given database type, throwing if no mapping is found. /// </para> /// <para> /// Note that sometimes the same store type can have different mappings; this method returns the default. /// </para> /// </summary> /// <param name="typeMapper"> The type mapper. </param> /// <param name="typeName"> The type to get the mapping for. </param> /// <returns> The type mapping to be used. </returns> public static RelationalTypeMapping GetMapping( [NotNull] this IRelationalCoreTypeMapper typeMapper, [NotNull] string typeName) { Check.NotNull(typeMapper, nameof(typeMapper)); Check.NotNull(typeName, nameof(typeName)); var mapping = typeMapper.FindMapping(typeName); if (mapping != null) { return(mapping); } throw new InvalidOperationException(RelationalStrings.UnsupportedType(typeName)); }
/// <summary> /// Creates a new <see cref="TypeMaterializationInfo" /> instance. /// </summary> /// <param name="modelType"> The type that is needed in the model after conversion. </param> /// <param name="property"> The property associated with the type, or <c>null</c> if none. </param> /// <param name="typeMapper"> The type mapper to use to find a mapping if the property does not have one already bound. </param> /// <param name="index"> /// The index of the underlying result set that should be used for this type, /// or -1 if no index mapping is needed. /// </param> public TypeMaterializationInfo( [NotNull] Type modelType, [CanBeNull] IProperty property, [CanBeNull] IRelationalCoreTypeMapper typeMapper, int index = -1) { Check.NotNull(modelType, nameof(modelType)); var mapping = property?.FindRelationalMapping() ?? typeMapper?.GetMapping(modelType); StoreType = mapping?.Converter?.StoreType ?? modelType.UnwrapNullableType().UnwrapEnumType(); ModelType = modelType; Mapping = mapping; Property = property; Index = index; }
/// <summary> /// Gets the relational database type for a given property, throwing if no mapping is found. /// </summary> /// <param name="typeMapper"> The type mapper. </param> /// <param name="property"> The property to get the mapping for. </param> /// <returns> The type mapping to be used. </returns> public static RelationalTypeMapping GetMapping( [NotNull] this IRelationalCoreTypeMapper typeMapper, [NotNull] IProperty property) { Check.NotNull(typeMapper, nameof(typeMapper)); Check.NotNull(property, nameof(property)); var mapping = property.FindRelationalMapping() ?? typeMapper.FindMapping(property); if (mapping != null) { return(mapping); } throw new InvalidOperationException( RelationalStrings.UnsupportedPropertyType( property.DeclaringEntityType.DisplayName(), property.Name, property.ClrType.ShortDisplayName())); }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="MigrationsSqlGenerator" />. /// </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> /// <param name="commandBuilderFactory"> The command builder factory. </param> /// <param name="updateSqlGenerator"> High level SQL generator. </param> /// <param name="sqlGenerationHelper"> Helpers for SQL generation. </param> /// <param name="typeMapper"> The type mapper being used. </param> /// <param name="coreTypeMapper"> The type mapper. </param> public MigrationsSqlGeneratorDependencies( [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory, [NotNull] ISingletonUpdateSqlGenerator updateSqlGenerator, [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IRelationalTypeMapper typeMapper, [NotNull] IRelationalCoreTypeMapper coreTypeMapper) { Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory)); Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator)); Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(typeMapper, nameof(typeMapper)); Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); CommandBuilderFactory = commandBuilderFactory; SqlGenerationHelper = sqlGenerationHelper; UpdateSqlGenerator = updateSqlGenerator; #pragma warning disable 618 TypeMapper = typeMapper; #pragma warning restore 618 CoreTypeMapper = coreTypeMapper; }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="SqlTranslatingExpressionVisitor" />. /// </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> /// <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> /// </summary> /// <param name="compositeExpressionFragmentTranslator"> The composite expression fragment translator. </param> /// <param name="methodCallTranslator"> The method call translator. </param> /// <param name="memberTranslator"> The member translator. </param> /// <param name="relationalTypeMapper"> The relational type mapper. </param> /// <param name="coreTypeMapper"> The type mapper. </param> public SqlTranslatingExpressionVisitorDependencies( [NotNull] IExpressionFragmentTranslator compositeExpressionFragmentTranslator, [NotNull] ICompositeMethodCallTranslator methodCallTranslator, [NotNull] IMemberTranslator memberTranslator, [NotNull] IRelationalTypeMapper relationalTypeMapper, [NotNull] IRelationalCoreTypeMapper coreTypeMapper) { Check.NotNull(compositeExpressionFragmentTranslator, nameof(compositeExpressionFragmentTranslator)); Check.NotNull(methodCallTranslator, nameof(methodCallTranslator)); Check.NotNull(memberTranslator, nameof(memberTranslator)); Check.NotNull(relationalTypeMapper, nameof(relationalTypeMapper)); Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); CompositeExpressionFragmentTranslator = compositeExpressionFragmentTranslator; MethodCallTranslator = methodCallTranslator; MemberTranslator = memberTranslator; #pragma warning disable 618 RelationalTypeMapper = relationalTypeMapper; #pragma warning restore 618 CoreTypeMapper = coreTypeMapper; }
/// <summary> /// Creates a new instance of <see cref="SqlTranslatingExpressionVisitor" />. /// </summary> /// <param name="dependencies"> Parameter object containing dependencies for this service. </param> /// <param name="queryModelVisitor"> The query model visitor. </param> /// <param name="targetSelectExpression"> The target select expression. </param> /// <param name="topLevelPredicate"> The top level predicate. </param> /// <param name="inProjection"> true if the expression to be translated is a LINQ projection. </param> public SqlTranslatingExpressionVisitor( [NotNull] SqlTranslatingExpressionVisitorDependencies dependencies, [NotNull] RelationalQueryModelVisitor queryModelVisitor, [CanBeNull] SelectExpression targetSelectExpression = null, [CanBeNull] Expression topLevelPredicate = null, bool inProjection = false) { Check.NotNull(dependencies, nameof(dependencies)); Check.NotNull(queryModelVisitor, nameof(queryModelVisitor)); _compositeExpressionFragmentTranslator = dependencies.CompositeExpressionFragmentTranslator; _methodCallTranslator = dependencies.MethodCallTranslator; _memberTranslator = dependencies.MemberTranslator; _typeMapper = dependencies.CoreTypeMapper; _queryModelVisitor = queryModelVisitor; _targetSelectExpression = targetSelectExpression; _topLevelPredicate = topLevelPredicate; _inProjection = inProjection; _nullCheckRemovalTestingVisitor = new NullCheckRemovalTestingVisitor(_queryModelVisitor); _isTopLevelProjection = inProjection; }
/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="QuerySqlGeneratorFactoryBase" />. /// </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> /// </summary> /// <param name="commandBuilderFactory"> The command builder factory. </param> /// <param name="sqlGenerationHelper"> The SQL generation helper. </param> /// <param name="parameterNameGeneratorFactory"> The parameter name generator factory. </param> /// <param name="relationalTypeMapper"> The relational type mapper. </param> /// <param name="coreTypeMapper"> The type mapper. </param> public QuerySqlGeneratorDependencies( [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory, [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IParameterNameGeneratorFactory parameterNameGeneratorFactory, [NotNull] IRelationalTypeMapper relationalTypeMapper, [NotNull] IRelationalCoreTypeMapper coreTypeMapper) { Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory)); Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(parameterNameGeneratorFactory, nameof(parameterNameGeneratorFactory)); Check.NotNull(relationalTypeMapper, nameof(relationalTypeMapper)); Check.NotNull(coreTypeMapper, nameof(coreTypeMapper)); CommandBuilderFactory = commandBuilderFactory; SqlGenerationHelper = sqlGenerationHelper; ParameterNameGeneratorFactory = parameterNameGeneratorFactory; #pragma warning disable 618 RelationalTypeMapper = relationalTypeMapper; #pragma warning restore 618 CoreTypeMapper = coreTypeMapper; }
/// <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 ScaffoldingTypeMapper([NotNull] IRelationalCoreTypeMapper typeMapper) { Check.NotNull(typeMapper, nameof(typeMapper)); _typeMapper = 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 RelationalTypeMappingConvention( [NotNull] IRelationalCoreTypeMapper typeMapper) { _typeMapper = typeMapper; }
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="coreTypeMapper"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public RelationalModelValidatorDependencies With([NotNull] IRelationalCoreTypeMapper coreTypeMapper) #pragma warning disable 618 => new RelationalModelValidatorDependencies(TypeMapper, coreTypeMapper);
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="typeMapper"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public RelationalConventionSetBuilderDependencies With([NotNull] IRelationalCoreTypeMapper typeMapper) => new RelationalConventionSetBuilderDependencies(typeMapper, Logger, Context, SetFinder);
/// <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> protected virtual IRelationalCommandBuilder CreateCore( [NotNull] IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger, [NotNull] IRelationalCoreTypeMapper relationalTypeMapper) => new RelationalCommandBuilder( logger, relationalTypeMapper);