Beispiel #1
0
        public static IServiceCollection AddEntityFrameworkAS400x([NotNull] this IServiceCollection serviceCollection)
        {
            Check.NotNull(serviceCollection, nameof(serviceCollection));
            var builder = new EntityFrameworkRelationalServicesBuilder(serviceCollection);

            builder.TryAdd <IDatabaseProvider, DatabaseProvider <AS400OptionsExtension> >();
            builder.TryAdd <IValueGeneratorCache>(p => p.GetService <IAS400ValueGeneratorCache>());
            builder.TryAdd <IRelationalTypeMapper, AS400TypeMapper>();
            builder.TryAdd <ISqlGenerationHelper, AS400SqlGenerationHelper>();
            //TODO  builder.TryAdd<IMigrationsAnnotationProvider, AS400MigrationsAnnotationProvider>();
            builder.TryAdd <IRelationalValueBufferFactoryFactory, UntypedRelationalValueBufferFactoryFactory>();
            builder.TryAdd <IModelValidator, AS400ModelValidator>();
            builder.TryAdd <IConventionSetBuilder, AS400ConventionSetBuilder>();
            builder.TryAdd <IUpdateSqlGenerator>(p => p.GetService <IAS400UpdateSqlGenerator>());
            builder.TryAdd <IModificationCommandBatchFactory, AS400ModificationCommandBatchFactory>();
            builder.TryAdd <IValueGeneratorSelector, AS400ValueGeneratorSelector>();
            builder.TryAdd <IRelationalConnection>(p => p.GetService <IAS400RelationalConnection>());
            //TODO  builder.TryAdd<IMigrationsSqlGenerator, AS400MigrationsSqlGenerator>();
            //TODO  builder.TryAdd<IRelationalDatabaseCreator, AS400DatabaseCreator>();
            //TODO  builder.TryAdd<IHistoryRepository, AS400HistoryRepository>();
            builder.TryAdd <ICompiledQueryCacheKeyGenerator, AS400CompiledQueryCacheKeyGenerator>();
            builder.TryAdd <IExecutionStrategyFactory, AS400ExecutionStrategyFactory>();
            builder.TryAdd <IQueryCompilationContextFactory, AS400QueryCompilationContextFactory>();
            builder.TryAdd <IMemberTranslator, AS400CompositeMemberTranslator>();
            builder.TryAdd <ICompositeMethodCallTranslator, AS400CompositeMethodCallTranslator>();
            builder.TryAdd <IQuerySqlGeneratorFactory, AS400QuerySqlGeneratorFactory>();
            builder.TryAdd <ISingletonOptions, IAS400Options>(p => p.GetService <IAS400Options>());
            builder.TryAddProviderSpecificServices(delegate(ServiceCollectionMap b) {
                b.TryAddSingleton <IAS400ValueGeneratorCache, AS400ValueGeneratorCache>();
                b.TryAddSingleton <IAS400Options, AS400Options>();
                b.TryAddScoped <IAS400UpdateSqlGenerator, AS400UpdateSqlGenerator>();
                b.TryAddScoped <IAS400SequenceValueGeneratorFactory, AS400SequenceValueGeneratorFactory>();
                b.TryAddScoped <IAS400RelationalConnection, AS400RelationalConnection>();
            });
            builder.TryAddCoreServices();
            return(serviceCollection);
        }