public static void AddDatabaseConfiguration(this IServiceCollection services, IConfiguration configuration)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddDbContext <ContextBase>(options =>
                                                options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext <EventStoreSqlContext>(options =>
                                                         options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
        }
        public static IServiceCollection IdentityConfig(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(
                                                             configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext <MeuDbContext>(options =>
                                                 options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            services.AddDefaultIdentity <IdentityUser>()
            .AddDefaultUI(UIFramework.Bootstrap4)
            .AddEntityFrameworkStores <ApplicationDbContext>();

            return(services);
        }
        public static IServiceCollection AddDbContext(this IServiceCollection service, IConfiguration configuration)
        {
            service.AddDbContext <DataContext>(options =>
                                               options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")));

            return(service);
        }
        public static ISiloBuilder ConfigureClustering(this ISiloBuilder siloBuilder, IConfiguration configuration, string clusterName)
        {
            var connectionString = configuration.GetConnectionString("AzureStorage");
            var buildConfig      = configuration.ExtractBuildConfig();

            siloBuilder.UseAzureStorageClustering(options =>
            {
                options.ConnectionString = connectionString;
                options.TableName        = clusterName + "ClusterInfo";
            });

            if (buildConfig.Equals(BuildConfig.Debug))
            {
                siloBuilder.ConfigureEndpoints(Dns.GetHostName(), 11111, 30000);
                siloBuilder.Configure <ClusterMembershipOptions>(x => x.ValidateInitialConnectivity = false);
                siloBuilder.Configure <ClusterOptions>(options =>
                {
                    options.ServiceId = $"{clusterName}Service";
                    options.ClusterId = $"{clusterName}Cluster";
                });
            }
            else
            {
                siloBuilder
                .UseKubernetesHosting();
            }

            return(siloBuilder);
        }
        public static ISiloBuilder ConfigurePersistentStreams(this ISiloBuilder siloBuilder, IConfiguration configuration)
        {
            var pullingPeriodConfig = configuration.ExtractClusterValue("PersistentStreamPullingPeriodMs");

            if (!int.TryParse(pullingPeriodConfig, out var pullingPeriod))
            {
                pullingPeriod = 5000;
            }
            siloBuilder
            .AddAzureQueueStreams(StreamProvider.Persistent, configurator =>
            {
                configurator.ConfigureAzureQueue(
                    ob => ob.Configure(options =>
                {
                    options.ConnectionString = configuration.GetConnectionString("AzureStorage");
                    options.QueueNames       = new List <string> {
                        "azurequeueprovider-0"
                    };
                }));
                configurator.ConfigureCacheSize(1024);
                configurator.ConfigurePullingAgent(ob => ob.Configure(options =>
                {
                    options.GetQueueMsgsTimerPeriod = TimeSpan.FromMilliseconds(pullingPeriod);
                }));
            });

            return(siloBuilder);
        }
예제 #6
0
        public static IServiceCollection AddCustomDbContext(this IServiceCollection services, IConfiguration configuration)
        {
            //string connnectionString = "Server=tcp:cdepoc.database.windows.net,1433;Initial Catalog=members;Persist Security Info=False;User ID=rjagadi;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
            services
            .AddEntityFrameworkSqlServer()
            .AddDbContext <MemberDataContext>(options =>
            {
                // options.UseInMemoryDatabase("members");
                //options.UseSqlServer(configuration.GetConnectionString("defaultConnection"));
                options.UseSqlServer(configuration.GetConnectionString("azureConnection"));
                //options.UseSqlServer(configuration.GetConnectionString("localDockerConnection"));
                //TODO: Uncomment when connecting to DB
                //options.UseSqlServer(connnectionString,
                //                   sqlServerOptionsAction: sqlOptions =>
                //                    {
                //                        sqlOptions.MigrationsAssembly(typeof(MemberDataContext).GetTypeInfo().Assembly.GetName().Name);
                //                        //                         //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
                //                        sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
                //                    });

                // Changing default behavior when client evaluation occurs to throw.
                // Default in EF Core would be to log a warning when client evaluation is performed.
                options.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning));
                //Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval
            },
                                              ServiceLifetime.Scoped
                                              );

            return(services);
        }
예제 #7
0
        public static void ConfigureServices(IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            services.AddDbContext <FamilyTreeContext>(op => op.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            services.AddTransient <IFamilyRepository, FamilyRepository>();
            services.AddTransient <IIndividualRepository, IndividualRepository>();
        }
예제 #8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient <IMailService, NullMailService>();
            // Support for real mail service

            services.AddMvc()
            .AddMvcOptions(o => o.OutputFormatters.Add(
                               new XmlDataContractSerializerOutputFormatter()));
            //.AddJsonOptions(o =>
            //{
            //    if (o.SerializerSettings.ContractResolver != null)
            //    {
            //        var castedResolver = o.SerializerSettings.ContractResolver
            //            as DefaultContractResolver;
            //        castedResolver.NamingStrategy = null;
            //    }
            //});
            services.AddScoped <ICityInfoRepository, CityInfoRepository>();

            services.AddDbContext <CityInfoContext>(options =>
            {
                options.UseSqlServer(_config.GetConnectionString("DefaultConnection"));
            });

            services.AddCors(c =>
            {
                c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin());
            });
            services.AddCors(c =>
            {
                c.AddPolicy("AllowOrigin", options => options.WithOrigins("http://localhost:3001"));
            });
        }
        public static IServiceCollection ConfigureMongoDb(this IServiceCollection services,
                                                          IConfiguration configuration)
        {
            var mongoConfigurations =
                configuration.GetSection(MongoDbConfiguration.SectionName).Get <MongoDbConfiguration>();

            BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String));

            BsonClassMap.RegisterClassMap <Customer>();
            BsonClassMap.RegisterClassMap <Preference>();
            BsonClassMap.RegisterClassMap <PromoCode>();

            services
            .AddSingleton <IMongoClient>(_ =>
                                         new MongoClient(configuration.GetConnectionString("MongoDb")))
            .AddSingleton(serviceProvider =>
                          serviceProvider.GetRequiredService <IMongoClient>()
                          .GetDatabase(mongoConfigurations.DatabaseName))
            .AddSingleton(serviceProvider =>
                          serviceProvider.GetRequiredService <IMongoDatabase>()
                          .GetCollection <Customer>(mongoConfigurations.CustomersCollectionName))
            .AddSingleton(serviceProvider =>
                          serviceProvider.GetRequiredService <IMongoDatabase>()
                          .GetCollection <Preference>(mongoConfigurations.PreferencesCollectionName))
            .AddSingleton(serviceProvider =>
                          serviceProvider.GetRequiredService <IMongoDatabase>()
                          .GetCollection <PromoCode>(mongoConfigurations.PromoCodesCollectionName))
            .AddScoped(serviceProvider =>
                       serviceProvider.GetRequiredService <IMongoClient>()
                       .StartSession());

            return(services);
        }
예제 #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            {
                Configuration.GetConnectionString("");
                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                    app.UseBrowserLink();
                }
                else
                {
                    app.UseExceptionHandler("/Home/Error");
                    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                    app.UseHsts();
                }
                //app.UseHttpsRedirection();
                app.UseStaticFiles();
                app.UseSession();
                app.UseRouting();

                app.UseAuthorization();

                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllerRoute(
                        name: null,
                        pattern: "",
                        defaults: new { controller = "Product", action = "List", category = (string)null, page = 1 }
                        );
                    endpoints.MapControllerRoute(
                        name: null,
                        pattern: "Page{page}",
                        defaults: new { controller = "Product", action = "List", category = (string)null }, new { page = @"\d+" }

                        );
                    endpoints.MapControllerRoute(
                        name: null,
                        pattern: "{page}",
                        defaults: new { controller = "Product", action = "List", category = (string)null }, new { page = @"\d+" }
                        );
                    endpoints.MapControllerRoute(
                        name: null,
                        pattern: "{category}",
                        defaults: new { controller = "Product", action = "List", page = 1 }
                        );
                    endpoints.MapControllerRoute(
                        name: null,
                        pattern: "{category}/Page{page}",
                        defaults: new { controller = "Product", action = "List" }, new { page = @"\d+" }
                        );
                    endpoints.MapControllerRoute(
                        name: "default",
                        pattern: "{controller=Product}/{action=List}/{id?}");
                    endpoints.MapControllerRoute(
                        name: "Cart",
                        pattern: "Cart/Index");
                });
            }
        }
        public static IServiceCollection AddCustomDbContext(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(configuration.GetConnectionString("DefaultConnection"))
                                                         );

            return(services);
        }
 public MedicamentsAggregatorContext CreateContext()
 {
     return(new MedicamentsAggregatorContext(
                new DbContextOptionsBuilder <MedicamentsAggregatorContext>()
                .UseNpgsql(_configuration.GetConnectionString("MedicamentsAggregator"))
                .UseLoggerFactory(EntityFrameworkLoggerFactory.Singleton)
                .Options));
 }
예제 #13
0
        private static void ConfigurationSqlServer(IServiceCollection services, IConfiguration configuration)
        {
            // entity framework db context
            string connString = configuration.GetConnectionString("CafeConnectionString"); //obtenemos la cadena de coneccion DESDE EL ARCHIVO APPSETTINGS

            services.AddDbContext <AtencionContext>(
                options => options.UseSqlServer(connString));
        }
        private static void ConfigureDb(IServiceCollection services, IConfiguration configuration, IHostingEnvironment env)
        {
            var connStringName = env.IsDevelopment() ? "LocalConnection" : "RemoteConnection";
            var connString     = configuration.GetConnectionString(connStringName);

            services.AddTransient <IGenericRepository, EntityFrameworkRepository>();
            services.AddScoped <DbContext>((provider) => new PlayTogetherDbContext(connString));
        }
        public static IServiceCollection ConfigureAdminUi(this IServiceCollection services, IConfiguration configuration)
        {
            var database   = configuration.GetValue <DatabaseType>("ApplicationSettings:DatabaseType");
            var connString = configuration.GetConnectionString("SSOConnection");

            services.ConfigureJpAdmin <AspNetUser>().AddDatabase(database, connString);

            return(services);
        }
예제 #16
0
        public static IServiceCollection AddInfrastructure(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            services.AddDbContext <NorthwindContext>
                (options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnectionString")));

            services.AddScoped <INorthwindContext>(provider => provider.GetService <NorthwindContext>());

            return(services);
        }
예제 #17
0
        public static IServiceCollection ConfigureAdminUi(this IServiceCollection services, IConfiguration configuration)
        {
            var database   = configuration.GetValue <DatabaseType>("ApplicationSettings:DatabaseType");
            var connString = configuration.GetConnectionString("SSOConnection");

            services.Configure <JpDatabaseOptions>(o => o.MustThrowExceptionIfDatabaseDontExist = false);
            services.ConfigureJpAdmin <AspNetUser>().AddDatabase(database, connString);

            return(services);
        }
예제 #18
0
        public static void AddDatabaseSetup(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddDbContext <EmployeeRegistrationContext>(options =>
                                                                options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
        }
예제 #19
0
 public static void AddServices(IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
 {
     services.AddDbContext <CollegePortalDbContext>(options =>
     {
         options.UseSqlServer(configuration.GetConnectionString("DbConnection"));
     });
     services.AddIdentity <User, Role>().AddEntityFrameworkStores <CollegePortalDbContext>().AddDefaultTokenProviders();
     services.AddScoped <DbContext, CollegePortalDbContext>();
     services.AddTransient <IStudentRepository, StudentRepository>();
 }
예제 #20
0
        public static IServiceCollection AddIdentityConfiguration(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(
                                                             configuration.GetConnectionString("DefaultConnection")));

            services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores <ApplicationDbContext>();

            return(services);
        }
예제 #21
0
        public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config)
        {
            services.AddDbContext <tlrmCartonContext>
                (options => options.UseSqlServer(config.GetConnectionString("tlrmCartonConnection")));
            services.AddScoped <IUserManagerRepository, UserManagerRepository>();
            services.AddAutoMapper(typeof(tlrmCartonContext).Assembly);
            services.AddScoped <IUserManagerRepository, UserManagerRepository>();
            services.AddScoped <IUserPasswordManagerRepository, UserPasswordManagerRepository>();
            services.AddScoped <ITokenServicesRepository, TokenServicesRepository>();
            services.AddScoped <ICustomerManagerRepository, CustomerManagerRepository>();
            services.AddScoped <ICartonStorageManagerRepository, CartonStorageManagerRepository>();
            services.AddScoped <ISearchManagerRepository, SearchManagerRepository>();
            services.AddScoped <IRequestManagerRepository, RequestManagerRepository>();
            services.AddScoped <IInvoiceManagerRepository, InvoiceManagerRepository>();
            services.AddScoped <IPickListManagerRepository, PickListManagerRepository>();
            services.AddScoped <IInquiryManagerRepository, InquiryManagerRepository>();
            services.AddScoped <IOwnershipManagerRepository, OwnershipManagerRepository>();
            services.AddScoped <ICompanyManagerRepository, CompanyManagerRepository>();
            services.AddScoped <IReportManagerRepository, ReportManagerRepository>();
            services.AddScoped <ILocationManagerRepository, LocationManagerRepository>();
            services.AddScoped <IGenericReportManagerRepository, GenericReportManagerRepository>();
            services.AddScoped <ReportGeneratingService>();
            services.AddScoped <IRolePermissionManagerRepository, RolePermissionManagerRepository>();
            services.AddScoped <UserService>();
            services.AddScoped <IDocketPrintManagerRepository, DocketPrintManagerRepository>();
            services.AddScoped <IImportDataManagerRepository, ImportDataManagerRepository>();
            services.AddScoped <ImportDataService>();
            services.AddScoped <IAccountManagerRepository, AccountManagerRepository>();
            services.AddScoped <IDashBoardManagerRepository, DashBoardManagerRepository>();

            //---Meta Data registration

            services.AddScoped <BaseMetaRepositoryValidator>();

            services.AddScoped(typeof(IMetadataRepository <StorageType, StorageTypeDto>), typeof(BaseMetadataRepository <StorageType, StorageTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <BillingCycle, BillingCycleDto>), typeof(BaseMetadataRepository <BillingCycle, BillingCycleDto>));
            services.AddScoped(typeof(IMetadataRepository <Route, RouteDto>), typeof(BaseMetadataRepository <Route, RouteDto>));
            services.AddScoped(typeof(IMetadataRepository <ServiceCategory, ServiceCategoryDto>), typeof(BaseMetadataRepository <ServiceCategory, ServiceCategoryDto>));
            services.AddScoped(typeof(IMetadataRepository <Department, DepartmentDto>), typeof(BaseMetadataRepository <Department, DepartmentDto>));
            services.AddScoped(typeof(IMetadataRepository <ReceiveType, ReceiveTypeDto>), typeof(BaseMetadataRepository <ReceiveType, ReceiveTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <RequestType, RequestTypeDto>), typeof(BaseMetadataRepository <RequestType, RequestTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <WorkOrderRequestType, WorkOrderTypeDto>), typeof(BaseMetadataRepository <WorkOrderRequestType, WorkOrderTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <DisposalTimeFrame, DisposalTimeFrameDto>), typeof(BaseMetadataRepository <DisposalTimeFrame, DisposalTimeFrameDto>));
            services.AddScoped(typeof(IMetadataRepository <TaxType, TaxTypeDto>), typeof(BaseMetadataRepository <TaxType, TaxTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <PostingType, PostingTypeDto>), typeof(BaseMetadataRepository <PostingType, PostingTypeDto>));
            services.AddScoped(typeof(IMetadataRepository <MobileDevice, MobileDeviceDto>), typeof(BaseMetadataRepository <MobileDevice, MobileDeviceDto>));
            services.AddScoped(typeof(IMetadataRepository <Module, ModuleMetaDataDto>), typeof(BaseMetadataRepository <Module, ModuleMetaDataDto>));
            services.AddScoped(typeof(IMetadataRepository <ModuleSub, ModuleSubMetaDataDto>), typeof(BaseMetadataRepository <ModuleSub, ModuleSubMetaDataDto>));

            //---------------------------------------------------------------

            services.AddAutoMapper(typeof(tlrmCartonContext).Assembly);
            return(services);
        }
        public static IServiceCollection ConfigureSsoApi(this IServiceCollection services, IConfiguration configuration)
        {
            var database   = configuration.GetValue <DatabaseType>("ApplicationSettings:DatabaseType");
            var connString = configuration.GetConnectionString("SSOConnection");

            services.ConfigureUserIdentity <AspNetUser>().AddDatabase(database, connString);

            services.ConfigureJpAdmin <AspNetUser>().AddDatabase(database, connString);
            services.UpgradePasswordSecurity().UseArgon2 <UserIdentity>();

            return(services);
        }
예제 #23
0
        public void InstallService(IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            services.AddDefaultIdentity <IdentityUser>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddScoped <IPostService, PostService>();
            services.AddScoped <IIdentityService, IdentityService>();
        }
예제 #24
0
        public static void ConfigureServices(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            var businessAssembly = Assembly.Load("GameSearch.BusinessLogicLayer");

            services.AddDbContext <GameSearchContext>(options =>
                                                      options.UseSqlServer(configuration.GetConnectionString("GameSearch")));

            services.Scan(scan => scan.FromAssemblies(businessAssembly)
                          .AddClasses(classes => classes.Where(type => type.Name.EndsWith("Service")))
                          .AsImplementedInterfaces())
            .AddAutoMapper(typeof(MapperProfile))
            .AddScoped(typeof(IRepository <>), typeof(Repository <>));
        }
예제 #25
0
        public static void ConfigureDalServices(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            //Add Database here, like
//#if DEBUG
//            services.AddDbContext<TextStatisticsContext>(opt =>  opt.UseInMemoryDatabase("TextStatistics"));
//#else
            services.AddDbContext <TextStatisticsContext>(c =>
            {
                c.UseSqlServer(configuration.GetConnectionString("DefaultConnection"));
            });
//#endif
            services.AddTransient <IStatisticDataService, StatisticDataService>();
        }
예제 #26
0
파일: Configure.cs 프로젝트: ktsin/CW_IGI
        // ReSharper disable once InconsistentNaming
        public static IServiceCollection ConfigureBLL(this IServiceCollection services,
                                                      string connectionString,
                                                      Microsoft.Extensions.Configuration.IConfiguration config)
        {
            services.ConfigureDAL(connectionString);
            services.AddScoped <FilesService>();
            services.AddScoped <GoodsService>();
            services.AddScoped <ManagersService>();
            services.AddScoped <MessageService>();
            services.AddScoped <OrderService>();
            services.AddScoped <StoreService>();
            services.AddScoped <UserService>();
#if DEBUG
            services.AddDbContext <DataLandfill.DataLandfillContext>(opt =>
                                                                     opt.UseSqlite(config.GetConnectionString("DataLandfillConnectionStringDebug")));
#endif
#if !DEBUG
            services.AddDbContext <DataLandfill.DataLandfillContext>(opt =>
                                                                     opt.UseNpgsql(config.GetConnectionString("DataLandfillConnectionString")));
#endif
            return(services);
        }
예제 #27
0
 public ApiRepository(Microsoft.Extensions.Configuration.IConfiguration configuration)
 {
     _connectionString = configuration.GetConnectionString("MainConnection");
     _kaspiBank        = configuration["Bank:Kaspi Bank"];
     _halykBank        = configuration["Bank:Halyk Bank"];
     _nationalBank     = configuration["Bank:NationalBank"];
     _dosCredoBank     = configuration["Bank:Dos CredoBank"];
     _dosCredoBankNal  = configuration["Bank:Dos CredoBankNal"];
     _CBU             = configuration["Bank:CBU"];
     _FMFB            = configuration["Bank:FMFB"];
     _alifBank        = configuration["Bank:Alif Bank"];
     _nationalBankTjs = configuration["Bank:NationalBankTJS"];
     _nationalBankMDL = configuration["Bank:NationalBankMDL"];
 }
예제 #28
0
        public static IServiceCollection AddCustomDbContext(this IServiceCollection services, IHostingEnvironment hostingEnv,
                                                            IConfiguration configuration)
        {
            services.AddDbContext <IdentityDbContext>(options =>
                                                      options.UseSqlServer(configuration.GetConnectionString("DatabaseConnection")));

            // Migrations
            if (!hostingEnv.IsDevelopment())
            {
                ApplyMigrations(services.BuildServiceProvider().GetService <IdentityDbContext>());
            }

            return(services);
        }
예제 #29
0
        public static IServiceCollection AddIdentityConfiguration(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseOracle(
                                                             configuration.GetConnectionString("DefaultConnection")));


            services.AddDbContext <MyDbContext>(options =>
                                                options.UseOracle(
                                                    configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("DevIO.App")));

            services.AddDefaultIdentity <IdentityUser>()
            .AddDefaultUI(UIFramework.Bootstrap4)
            .AddEntityFrameworkStores <ApplicationDbContext>();

            return(services);
        }
예제 #30
0
        public static void Register(IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration cfg, Action <Type> setMediator)
        {
            var conn = cfg.GetConnectionString("AccountDB");

            services.AddDbContext <AppDbContext>(options => options.UseSqlServer(conn));
            services.AddScoped <IAccountRepository, AccountRepository>();
            services.AddScoped <ITransferRepository, TrasnferRepository>();

            setMediator(typeof(AccountQueryHandler));
            setMediator(typeof(TrasnferCommandHandler));
            //foreach (var item in CQRSHelper.Loader.GetAll())
            //{
            //    setMediator(item);
            //}
        }