/// <summary> /// Debug arg /// -f = flash local /// -s = seed local /// </summary> /// <param name="args"></param> public static void Main(string[] args) { ShowHeader(); var builder = IocContainer.GetBuilder(Assembly.GetAssembly(typeof(Domain.CollectionBase))); // this will add all your Request- and Notificationhandler // that are located in the same project as your program-class builder.AddMediatR(typeof(Program).Assembly); IocContainer.CreateContainer(builder); _mediator = IocContainer.Container.Resolve <IMediator>(); var found = IocContainer.Container.Resolve <CreateCompanyCommandHandler>(); Debug.Assert(found != null); Parser.Default.ParseArguments <Options>(args) .WithParsed(async opts => await ParseOptions(opts)) .WithNotParsed(ShowParseError); }
public IServiceProvider ConfigureServices(IServiceCollection services) { // AddCors must be before AddMvc services.AddCors(options => { options.AddPolicy("AllowAll", b => b .AllowAnyOrigin() .AllowAnyMethod() .AllowCredentials() .AllowAnyHeader()); }); //services.Configure<MvcOptions>(options => { // options.Filters.Add(new CorsAuthorizationFilterFactory("AllowAnyOrigin")); //}); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options => { options.Authority = $"https://{Configuration["Auth0:Domain"]}/"; options.Audience = Configuration["Auth0:ApiIdentifier"]; }); var builder = IocContainer.GetBuilder(Assembly.GetAssembly(typeof(CollectionBase)), new List <Module> { new PredictionModule() }); builder.Populate(services); IocContainer.CreateContainer(builder); var autofacServiceProvider = new AutofacServiceProvider(IocContainer.Container); return(autofacServiceProvider); }