Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(
            IServiceCollection services)
        {
            services.AddControllers();
            services.AddSwaggerGen(
                c => {
                c.SwaggerDoc(
                    "v1",
                    new OpenApiInfo {
                    Title   = "TheStore.Api.Front",
                    Version = "v1"
                });
            });

            var dbSettings = SettingsBuilder.GetDbSettings();

            services.AddTransient(r =>
                                  new TheStoreRepository(dbSettings.GetConnectionString(), dbSettings.Version));
            services.AddSingleton <Proxies>();
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(
            IServiceCollection services)
        {
            var dbSettings = SettingsBuilder.GetDbSettings();

            services.AddControllers();
            services.AddSwaggerGen(
                c => {
                c.SwaggerDoc(
                    "v1",
                    new OpenApiInfo {
                    Title   = "TheStore.Api.Core",
                    Version = "v1"
                });
            });
            var settingsBuilder = new SettingsBuilder(new DbHelper(SettingsBuilder.GetDbSettings()));

            services.AddTransient(provider => settingsBuilder.GetSettings());
            services.AddSingleton <PriorityQueue>();
            services.AddSingleton <BackgroundWorks>();
            services.AddTransient(r =>
                                  new TheStoreRepository(dbSettings.GetConnectionString(), dbSettings.Version));
            services.AddScoped(r => new DbHelper(dbSettings));
        }
Beispiel #3
0
 public void GetShopsTest()
 {
     var settings = SettingsBuilder.GetDbSettings();
     var rep      = new ShopRepository(settings.GetConnectionString(), settings.Version);
     var shops    = rep.GetEnableShops();
 }
Beispiel #4
0
        private static DbHelper GetDbHelper()
        {
            var settings = SettingsBuilder.GetDbSettings();

            return(new DbHelper(settings));
        }
Beispiel #5
0
 public void GetCategories()
 {
     var settings   = SettingsBuilder.GetDbSettings();
     var rep        = new CategoryRepository(settings.GetConnectionString(), settings.Version);
     var categories = rep.GetCategoriesWithTerms();
 }