// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <OrdersDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("FokOrdersDB")); }); services.AddScoped <IOrdersService, OrdersService>(); services.AddSingleton <IOrdersEventManager, OrdersEventManager>(); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); services.AddCors(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <DeliveriesDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("FokDeliveriesDB"), x => x.UseNetTopologySuite()); }); services.AddScoped <IDeliveryService, DeliveryService>(); services.AddScoped <IRiderService, RiderService>(); services.AddSingleton <ILogService, LogService>(); services.AddHostedService <RiderHandlerHostedService>(); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.DateTimeItFormatter(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var notificationConfigSection = Configuration.GetSection("NotificationHubConfig"); var notifications = new Notifications(notificationConfigSection["SubscriptionId"], notificationConfigSection["Name"]); services.AddSingleton <Notifications>(notifications); services.AddSingleton <INotificationEventManager, NotificationEventsManager>(); services.Configure <NotificationHubConfig>(Configuration.GetSection("NotificationHubConfig")); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.DateTimeItFormatter(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <RestaurantsDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("FokRestaurantsDB")); }); //registering restaurants service services.AddScoped <IRestaurantService, RestaurantService>(); services.AddScoped <IRestaurantMenuService, RestaurantMenuService>(); //registering bus event manager services.AddSingleton <IRestaurantsEventsManager, RestaurantsEventsManager>(); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); services.AddCors(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ReviewsDBContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("FokReviewsDB")); }); //registering feedbackservice service services.AddScoped <IReviewService, ReviewService>(); services.AddSingleton <ILogService, LogService>(); //registering bus event manager services.AddSingleton <IReviewEventsManager, ReviewEventsManager>(); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); services.AddCors(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.DateTimeItFormatter(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddStackExchangeRedisCache(opt => { opt.Configuration = Configuration.GetSection("RedisConfig").GetValue <string>("connection"); }); services.AddScoped <IBasketService, BasketService>(); services.AddScoped <IBasketRepository, RedisBasketRepository>(); services.Configure <RedisConfig>(Configuration.GetSection("RedisConfig")); services.AddSingleton <ConnectionMultiplexer>(sp => { var configuration = ConfigurationOptions.Parse(Configuration.GetSection("RedisConfig").GetValue <string>("connection"), true); configuration.ResolveDns = true; return(ConnectionMultiplexer.Connect(configuration)); }); services.AddSingleton <Microsoft.Extensions.Hosting.IHostedService, BasketEventsManager>(); LogMiddleware.AddRabbitMQConfiguration(services, Configuration); }