// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddDbContext <DataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddDbContext <EventStoreContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddAutoMapper(); services.RegisterServices(); services.ConfigureSwagger(); // MediatR services.AddMediatR(typeof(Startup)); NativeInjectionDependency.RegisterServices(services); services.AddCors(options => { options.AddPolicy("BaseCorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); }); }
public static IServiceCollection RegisterServices(this IServiceCollection services) { NativeInjectionDependency.RegisterServices(services); return(services); }