// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy( name: AllowOriginsName, builder => { builder.WithOrigins("http://localhost:5000"); } ); }); services.AddControllers(opts => { opts.ModelBinderProviders.Insert(0, new FilterModelBinderProvider()); }); // Custom configuration var config = new EONETConfiguration(); Configuration.Bind(EONETConfiguration.EONET, config); services.AddSingleton(config); // Custom services services.AddScoped <IEventRepository, EventRepository>(); services.AddScoped <IEventService, EventService>(); services.AddScoped <ICategoryRepository, CategoryRepository>(); services.AddScoped <ICategoryService, CategoryService>(); }
public CategoryRepository(EONETConfiguration config) { _config = config; }
public EventRepository(EONETConfiguration config) { _config = config; }