/// <summary> /// Registers default implementations of all services, including relational services, not already /// registered by the provider. Relational database providers must call this method as the last /// step of service registration--that is, after all provider services have been registered. /// </summary> /// <returns> This builder, such that further calls can be chained. </returns> public override EntityFrameworkServicesBuilder TryAddCoreServices() { TryAdd <LoggingDefinitions, RelationalLoggingDefinitions>(); TryAdd <IParameterNameGeneratorFactory, ParameterNameGeneratorFactory>(); TryAdd <IComparer <ModificationCommand>, ModificationCommandComparer>(); TryAdd <IMigrationsIdGenerator, MigrationsIdGenerator>(); TryAdd <IKeyValueIndexFactorySource, KeyValueIndexFactorySource>(); TryAdd <IModelCustomizer, RelationalModelCustomizer>(); TryAdd <IMigrationsAnnotationProvider, MigrationsAnnotationProvider>(); TryAdd <IModelValidator, RelationalModelValidator>(); TryAdd <IMigrator, Migrator>(); TryAdd <IMigrationCommandExecutor, MigrationCommandExecutor>(); TryAdd <IMigrationsAssembly, MigrationsAssembly>(); TryAdd <IDatabase, RelationalDatabase>(); TryAdd <IBatchExecutor, BatchExecutor>(); TryAdd <IValueGeneratorSelector, RelationalValueGeneratorSelector>(); TryAdd <IRelationalCommandBuilderFactory, RelationalCommandBuilderFactory>(); TryAdd <IRawSqlCommandBuilder, RawSqlCommandBuilder>(); TryAdd <ICommandBatchPreparer, CommandBatchPreparer>(); TryAdd <IMigrationsModelDiffer, MigrationsModelDiffer>(); TryAdd <IMigrationsSqlGenerator, MigrationsSqlGenerator>(); TryAdd <IExecutionStrategyFactory, RelationalExecutionStrategyFactory>(); TryAdd <ITypeMappingSource>(p => p.GetService <IRelationalTypeMappingSource>()); TryAdd <IRelationalValueBufferFactoryFactory, TypedRelationalValueBufferFactoryFactory>(); TryAdd <IDatabaseCreator>(p => p.GetService <IRelationalDatabaseCreator>()); TryAdd <IDbContextTransactionManager>(p => p.GetService <IRelationalConnection>()); TryAdd <IMaterializerFactory, MaterializerFactory>(); TryAdd <IShaperCommandContextFactory, ShaperCommandContextFactory>(); TryAdd <IConditionalRemovingExpressionVisitorFactory, ConditionalRemovingExpressionVisitorFactory>(); TryAdd <ICompositePredicateExpressionVisitorFactory, CompositePredicateExpressionVisitorFactory>(); TryAdd <ISelectExpressionFactory, SelectExpressionFactory>(); TryAdd <IExpressionPrinter, RelationalExpressionPrinter>(); TryAdd <IRelationalResultOperatorHandler, RelationalResultOperatorHandler>(); TryAdd <IQueryContextFactory, RelationalQueryContextFactory>(); TryAdd <IQueryCompilationContextFactory, RelationalQueryCompilationContextFactory>(); TryAdd <IEntityQueryableExpressionVisitorFactory, RelationalEntityQueryableExpressionVisitorFactory>(); TryAdd <IEntityQueryModelVisitorFactory, RelationalQueryModelVisitorFactory>(); TryAdd <IProjectionExpressionVisitorFactory, RelationalProjectionExpressionVisitorFactory>(); TryAdd <ICompiledQueryCacheKeyGenerator, RelationalCompiledQueryCacheKeyGenerator>(); TryAdd <IExpressionFragmentTranslator, RelationalCompositeExpressionFragmentTranslator>(); TryAdd <ISqlTranslatingExpressionVisitorFactory, SqlTranslatingExpressionVisitorFactory>(); TryAdd <INamedConnectionStringResolver, NamedConnectionStringResolver>(); TryAdd <ReLinq.IEvaluatableExpressionFilter, ReLinqRelationalEvaluatableExpressionFilter>(); TryAdd <IEvaluatableExpressionFilter, RelationalEvaluatableExpressionFilter>(); TryAdd <IRelationalTransactionFactory, RelationalTransactionFactory>(); ServiceCollectionMap.GetInfrastructure() .AddDependencySingleton <RelationalCompositeMemberTranslatorDependencies>() .AddDependencySingleton <RelationalSqlGenerationHelperDependencies>() .AddDependencySingleton <RelationalTypeMappingSourceDependencies>() .AddDependencySingleton <RelationalCompositeExpressionFragmentTranslatorDependencies>() .AddDependencySingleton <RelationalModelValidatorDependencies>() .AddDependencySingleton <UpdateSqlGeneratorDependencies>() .AddDependencySingleton <QuerySqlGeneratorDependencies>() .AddDependencySingleton <RelationalCompositeMethodCallTranslatorDependencies>() .AddDependencySingleton <MigrationsAnnotationProviderDependencies>() .AddDependencySingleton <SqlTranslatingExpressionVisitorDependencies>() .AddDependencySingleton <ParameterNameGeneratorDependencies>() .AddDependencySingleton <RelationalValueBufferFactoryDependencies>() .AddDependencySingleton <RelationalProjectionExpressionVisitorDependencies>() .AddDependencySingleton <RelationalTransactionFactoryDependencies>() .AddDependencySingleton <SelectExpressionDependencies>() .AddDependencySingleton <RelationalCommandBuilderDependencies>() .AddDependencyScoped <MigrationsSqlGeneratorDependencies>() .AddDependencyScoped <RelationalConventionSetBuilderDependencies>() .AddDependencyScoped <ModificationCommandBatchFactoryDependencies>() .AddDependencyScoped <CommandBatchPreparerDependencies>() .AddDependencyScoped <RelationalDatabaseCreatorDependencies>() .AddDependencyScoped <HistoryRepositoryDependencies>() .AddDependencyScoped <RelationalCompiledQueryCacheKeyGeneratorDependencies>() .AddDependencyScoped <RelationalQueryModelVisitorDependencies>() .AddDependencyScoped <RelationalEntityQueryableExpressionVisitorDependencies>() .AddDependencyScoped <RelationalConnectionDependencies>() .AddDependencyScoped <RelationalDatabaseDependencies>() .AddDependencyScoped <RelationalQueryCompilationContextDependencies>(); return(base.TryAddCoreServices()); }
/// <summary> /// Registers default implementations of all services, including relational services, not already /// registered by the provider. Relational database providers must call this method as the last /// step of service registration--that is, after all provider services have been registered. /// </summary> /// <returns> This builder, such that further calls can be chained. </returns> public override EntityFrameworkServicesBuilder TryAddCoreServices() { TryAdd <IParameterNameGeneratorFactory, ParameterNameGeneratorFactory>(); TryAdd <IComparer <ModificationCommand>, ModificationCommandComparer>(); TryAdd <IMigrationsIdGenerator, MigrationsIdGenerator>(); TryAdd <IKeyValueIndexFactorySource, KeyValueIndexFactorySource>(); TryAdd <IModelCustomizer, RelationalModelCustomizer>(); TryAdd <IMigrationsAnnotationProvider, MigrationsAnnotationProvider>(); TryAdd <IModelValidator, RelationalModelValidator>(); TryAdd <IMigrator, Migrator>(); TryAdd <IMigrationCommandExecutor, MigrationCommandExecutor>(); TryAdd <IMigrationsAssembly, MigrationsAssembly>(); TryAdd <IDatabase, RelationalDatabase>(); TryAdd <IBatchExecutor, BatchExecutor>(); TryAdd <IValueGeneratorSelector, RelationalValueGeneratorSelector>(); TryAdd <IRelationalCommandBuilderFactory, RelationalCommandBuilderFactory>(); TryAdd <IRawSqlCommandBuilder, RawSqlCommandBuilder>(); TryAdd <ICommandBatchPreparer, CommandBatchPreparer>(); TryAdd <IMigrationsModelDiffer, MigrationsModelDiffer>(); TryAdd <IMigrationsSqlGenerator, MigrationsSqlGenerator>(); TryAdd <IExecutionStrategyFactory, RelationalExecutionStrategyFactory>(); TryAdd <ITypeMappingSource>(p => p.GetService <IRelationalTypeMappingSource>()); TryAdd <IRelationalValueBufferFactoryFactory, TypedRelationalValueBufferFactoryFactory>(); TryAdd <IDatabaseCreator>(p => p.GetService <IRelationalDatabaseCreator>()); TryAdd <IDbContextTransactionManager>(p => p.GetService <IRelationalConnection>()); TryAdd <IQueryContextFactory, RelationalQueryContextFactory>(); TryAdd <ICompiledQueryCacheKeyGenerator, RelationalCompiledQueryCacheKeyGenerator>(); TryAdd <INamedConnectionStringResolver, NamedConnectionStringResolver>(); TryAdd <IEvaluatableExpressionFilter, RelationalEvaluatableExpressionFilter>(); TryAdd <IRelationalTransactionFactory, RelationalTransactionFactory>(); TryAdd <IDatabaseFacadeDependencies>(p => p.GetService <IRelationalDatabaseFacadeDependencies>()); TryAdd <IRelationalDatabaseFacadeDependencies, RelationalDatabaseFacadeDependencies>(); TryAdd <IInterceptorAggregator, DbConnectionInterceptorAggregator>(); TryAdd <IInterceptorAggregator, DbTransactionInterceptorAggregator>(); TryAdd <IInterceptorAggregator, DbCommandInterceptorAggregator>(); // New Query pipeline TryAdd <IQuerySqlGeneratorFactory, QuerySqlGeneratorFactory>(); TryAdd <IShapedQueryCompilingExpressionVisitorFactory, RelationalShapedQueryCompilingExpressionVisitorFactory>(); TryAdd <IQueryableMethodTranslatingExpressionVisitorFactory, RelationalQueryableMethodTranslatingExpressionVisitorFactory>(); TryAdd <IMethodCallTranslatorProvider, RelationalMethodCallTranslatorProvider>(); TryAdd <IMemberTranslatorProvider, RelationalMemberTranslatorProvider>(); TryAdd <IShapedQueryOptimizerFactory, RelationalShapedQueryOptimizerFactory>(); TryAdd <IRelationalSqlTranslatingExpressionVisitorFactory, RelationalSqlTranslatingExpressionVisitorFactory>(); TryAdd <ISqlExpressionFactory, SqlExpressionFactory>(); ServiceCollectionMap.GetInfrastructure() .AddDependencySingleton <RelationalSqlGenerationHelperDependencies>() .AddDependencySingleton <RelationalTypeMappingSourceDependencies>() .AddDependencySingleton <RelationalModelValidatorDependencies>() .AddDependencySingleton <UpdateSqlGeneratorDependencies>() .AddDependencySingleton <MigrationsAnnotationProviderDependencies>() .AddDependencySingleton <ParameterNameGeneratorDependencies>() .AddDependencySingleton <RelationalValueBufferFactoryDependencies>() .AddDependencySingleton <RelationalTransactionFactoryDependencies>() .AddDependencySingleton <RelationalCommandBuilderDependencies>() .AddDependencySingleton <SqlExpressionFactoryDependencies>() .AddDependencySingleton <RelationalMethodCallTranslatorProviderDependencies>() .AddDependencySingleton <RelationalMemberTranslatorProviderDependencies>() .AddDependencySingleton <RelationalSqlTranslatingExpressionVisitorDependencies>() .AddDependencySingleton <RelationalQueryableMethodTranslatingExpressionVisitorDependencies>() .AddDependencySingleton <QuerySqlGeneratorDependencies>() .AddDependencySingleton <RelationalShapedQueryCompilingExpressionVisitorDependencies>() .AddDependencySingleton <RelationalShapedQueryOptimizerDependencies>() .AddDependencyScoped <MigrationsSqlGeneratorDependencies>() .AddDependencyScoped <RelationalConventionSetBuilderDependencies>() .AddDependencyScoped <ModificationCommandBatchFactoryDependencies>() .AddDependencyScoped <CommandBatchPreparerDependencies>() .AddDependencyScoped <RelationalDatabaseCreatorDependencies>() .AddDependencyScoped <HistoryRepositoryDependencies>() .AddDependencyScoped <RelationalCompiledQueryCacheKeyGeneratorDependencies>() .AddDependencyScoped <RelationalConnectionDependencies>() .AddDependencyScoped <RelationalDatabaseDependencies>() .AddDependencyScoped <RelationalQueryContextDependencies>() .AddDependencyScoped <RelationalEvaluatableExpressionFilterDependencies>(); return(base.TryAddCoreServices()); }
/// <summary> /// /// </summary> /// <returns></returns> public override EntityFrameworkServicesBuilder TryAddCoreServices() { // TODO: Register services // Model TryAdd <IModelSource, RelationalModelSource>(); // RelationalModelSource just extends ModelSource TryAdd <IModelValidator, CypherModelValidator>(); TryAdd <IModelCustomizer, CypherModelCustomizer>(); ServiceCollectionMap.GetInfrastructure() .AddDependencySingleton <RelationalTypeMapperDependencies>() .AddDependencySingleton <RelationalModelValidatorDependencies>() .AddDependencyScoped <RelationalConventionSetBuilderDependencies>(); // Migrations // Despite the semantic discomfort with SQL prefixes most of the relational command/database services can be reused TryAdd <IDatabase, RelationalDatabase>(); TryAdd <IRawSqlCommandBuilder, RawSqlCommandBuilder>(); TryAdd <IRelationalCommandBuilderFactory, RelationalCommandBuilderFactory>(); TryAdd <IParameterNameGeneratorFactory, ParameterNameGeneratorFactory>(); ServiceCollectionMap.GetInfrastructure() .AddDependencyScoped <RelationalConnectionDependencies>() .AddDependencyScoped <RelationalDatabaseDependencies>() .AddDependencySingleton <RelationalSqlGenerationHelperDependencies>() .AddDependencySingleton <ParameterNameGeneratorDependencies>(); // Relinq (i.e. INodeTypeProviderFactory) // Query TryAdd <IQueryContextFactory, RelationalQueryContextFactory>(); TryAdd <IQueryCompilationContextFactory, CypherQueryCompilationContextFactory>(); TryAdd <IEntityQueryableExpressionVisitorFactory, CypherEntityQueryableExpressionVisitorFactory>(); TryAdd <IEntityQueryModelVisitorFactory, CypherQueryModelVisitorFactory>(); TryAdd <IEvaluatableExpressionFilter, RelationalEvaluatableExpressionFilter>(); TryAdd <ICypherResultOperatorHandler, CypherResultOperatorHandler>(); TryAdd <ICypherMaterializerFactory, CypherMaterializerFactory>(); TryAdd <IRelationalValueBufferFactoryFactory, TypedRelationalValueBufferFactoryFactory>(); TryAdd <IShaperCommandContextFactory, ShaperCommandContextFactory>(); TryAdd <IReadOnlyExpressionFactory, ReadOnlyExpressionFactory>(); TryAdd <IExpressionFragmentTranslator, RelationalCompositeExpressionFragmentTranslator>(); TryAdd <ICypherTranslatingExpressionVisitorFactory, CypherTranslatingExpressionVisitorFactory>(); TryAdd <IProjectionExpressionVisitorFactory, CypherProjectionExpressionVisitorFactory>(); TryAdd <IRequiresMaterializationExpressionVisitorFactory, CypherRequiresMaterializationExpressionVisitorFactory>(); ServiceCollectionMap.GetInfrastructure() .AddDependencySingleton <RelationalCompositeMemberTranslatorDependencies>() .AddDependencyScoped <RelationalQueryCompilationContextDependencies>() .AddDependencyScoped <CypherEntityQueryableExpressionVisitorDependencies>() .AddDependencySingleton <RelationalCompositeExpressionFragmentTranslatorDependencies>() .AddDependencyScoped <CypherQueryModelVisitorDependencies>() .AddDependencyScoped <RelationalQueryCompilationContextDependencies>() .AddDependencySingleton <ReadOnlyExpressionDependencies>() .AddDependencySingleton <QuerySqlGeneratorDependencies>() .AddDependencySingleton <RelationalCompositeMethodCallTranslatorDependencies>() .AddDependencySingleton <RelationalValueBufferFactoryDependencies>() .AddDependencySingleton <SqlTranslatingExpressionVisitorDependencies>() .AddDependencySingleton <CypherProjectionExpressionVisitorDependencies>(); // Update TryAdd <ICommandBatchPreparer, CommandBatchPreparer>(); TryAdd <IComparer <ModificationCommand>, ModificationCommandComparer>(); TryAdd <IKeyValueIndexFactorySource, KeyValueIndexFactorySource>(); TryAdd <IBatchExecutor, BatchExecutor>(); // Relational transaction factory (post 2.0) return(base.TryAddCoreServices()); }