Esempio n. 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(options => { options.Filters.Add(typeof(ApiExceptionFilter)); });

            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist/AzureSpeedFrontend";
            });

            services.AddCors("CorsPolicy");

            services.AddSingleton <IFileProvider>(this.webHostEnvironment.ContentRootFileProvider);
            services.AddSingleton <IAzureIPInfoProvider, AzureIPInfoProvider>();
            services.AddSingleton <ILegacyAzureIPInfoProvider, LegacyAzureIPInfoProvider>(serviceProvider =>
            {
                var localDataStoreContext = new LegacyAzureIPInfoProvider(webHostEnvironment.ContentRootPath);
                return(localDataStoreContext);
            });
            services.AddSingleton <StorageAccountsContext>(serviceProvider =>
            {
                var localDataStoreContext = new StorageAccountsContext(webHostEnvironment.ContentRootPath);
                return(localDataStoreContext);
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers(options => { options.Filters.Add(typeof(ApiExceptionFilter)); });

            services.AddCors("CorsPolicy");

            services.AddSingleton <IFileProvider>(this.webHostEnvironment.ContentRootFileProvider);
            services.AddSingleton <IAzureIPInfoProvider, AzureIPInfoProvider>();
            services.AddSingleton <ILegacyAzureIPInfoProvider, LegacyAzureIPInfoProvider>(serviceProvider =>
            {
                var localDataStoreContext = new LegacyAzureIPInfoProvider(webHostEnvironment.ContentRootPath);
                return(localDataStoreContext);
            });
            services.AddSingleton <StorageAccountsContext>(serviceProvider =>
            {
                var localDataStoreContext = new StorageAccountsContext(webHostEnvironment.ContentRootPath);
                return(localDataStoreContext);
            });
        }
        public LegacyAzureIPInfoProviderTest()
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            this.legacyAzureIpInfoProvider = new LegacyAzureIPInfoProvider(path);
        }