예제 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ProductCatalogContext>(options =>
                                                          options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                               o => o.MigrationsHistoryTable("_ProductCatalog_MigrationHistory")), ServiceLifetime.Scoped);

            services.AddDbContext <OrderContext>(options =>
                                                 options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                      o => o.MigrationsHistoryTable("_Order_MigrationHistory")), ServiceLifetime.Scoped);

            services.AddDbContext <ShoppingVanContext>(options =>
                                                       options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                            o => o.MigrationsHistoryTable("_ShoppingVan_MigrationHistory")), ServiceLifetime.Scoped);

            services.AddDbContext <CustomerManagmentContext>(options =>
                                                             options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                                  o => o.MigrationsHistoryTable("_CustomerManagment_MigrationHistory")));

            services.AddDbContext <DistributorManagmentContext>(options =>
                                                                options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                                     o => o.MigrationsHistoryTable("_DistributorManagment_MigrationHistory")));

            services.AddDbContext <OfferContext>(options =>
                                                 options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                      o => o.MigrationsHistoryTable("_OfferManagment_MigrationHistory")));

            services.AddDbContext <NotificationContext>(options =>
                                                        options.UseSqlServer(Configuration.GetConnectionString("BrimoDatabase"),
                                                                             o => o.MigrationsHistoryTable("_NotificationManagment_MigrationHistory")));

            AzureConfigurations azureConfigurations = new AzureConfigurations();

            Configuration.Bind("AzureConfigurations", azureConfigurations);
            services.AddSingleton(azureConfigurations);

            services.AddSingleton <IPhotoRepository, PhotoRepository>();
        }
예제 #2
0
 public PhotoRepository(AzureConfigurations azureConfigurations)
 {
     _blobContainerClient = new BlobContainerClient(azureConfigurations.ConnectionString, azureConfigurations.BlobContainerName);
     _blobContainerClient.CreateIfNotExists();
 }