// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { AuthConfig.Configure(services, Configuration); PolicyOrigin.ConfigureServicesPolicyUI(services, new String[] { "http://localhost:4200" }); //Load mongodb settings in RestaurantDatabaseSetting where is in appsettings.json with name : RestaurantDatabaseSetting services.Configure <DatabaseSettings>(Configuration.GetSection(nameof(DatabaseSettings))); //Define an interface who serve setting mongodb access services.AddSingleton <IDatabaseSettings>(sp => sp.GetRequiredService <IOptions <DatabaseSettings> >().Value); //Define Restaurant service data access services.AddTransient <IMongoDBContext <ForumObj>, MongoDBContext <ForumObj, IDatabaseSettings> >(); services.AddSingleton <CacheUserWs>(); services.AddTransient <IForumManagerView, ForumManager>(); services.AddTransient <IForumManager, ForumManager>(); services.AddTransient <IChannelManagerView, ChannelsManager>(); services.AddTransient <IChannelManager, ChannelsManager>(); services.AddTransient <IMessageManagerView, MessageManager>(); services.AddTransient <IMessageManager, MessageManager>(); //Websocket services.AddSignalR(); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "ForumsService", Version = "v1" }); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { //TODO: //if (env.IsDevelopment()) // app.UseDeveloperExceptionPage(); BackgroundServiceConfig.Configure(app, env, loggerFactory, Configuration); DataConfig.Configure(app, env, loggerFactory, Configuration); LogConfig.Configure(app, env, loggerFactory, Configuration); AuthConfig.Configure(app, env, loggerFactory, Configuration); MvcConfig.Configure(app, env, loggerFactory, Configuration); ReportServiceConfig.Configure(app, env, loggerFactory, Configuration); MessageHubConfig.Configure(app, env, loggerFactory, Configuration); }
public void Configuration(IAppBuilder app) { // Useful for Swagger implemetation //GlobalConfiguration.Configure((configuration) => { configuration.MapHttpAttributeRoutes(); }); HttpConfiguration config = new HttpConfiguration() { // Add this line to enable detail mode in release IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always }; WebApiConfig.Register(config); AuthConfig.Configure(app); MappingConfig.Register(); app.UseWebApi(config); }
// TODO: Stop invoking this at startup! void ExternalServiceInvocation(IAppBuilder appBuilder) { // This is the type of shit that should *not* be invoked // during startup, and wait till a page that needs it // invokes it. // Faster startup, and no yellow screen that can't be easily diagnosed. // This kind of stuff feels useful when developing, but always comes // back to bite you. //TODO: This triggers requests to a remote server during bootstrap... // contrary to design principles, and should be // moved to later _authConfig.Configure(appBuilder); //Invoke Service Initialization: this._initializerConfig.Configure(appBuilder); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) { ErrorHandlerConfig.Configure(app, env); app.UseHttpsRedirection(); app.UseRouting(); CorsConfig.Configure(app, env); AuthConfig.Configure(app, env); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); SwaggerConfig.Configure(app, env, provider); }
public void Configuration(IAppBuilder app) { AuthConfig.Configure(app); }
public static void Configure(IAppBuilder app) { ConfigDebugMiddleware(app); AuthConfig.Configure(app); }