diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj
index 2f519fc95..41281cf54 100644
--- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj
+++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj
@@ -1,19 +1,13 @@
- netstandard1.5
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks
-
-
-
+
-
+
\ No newline at end of file
diff --git a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj
index 8589f6035..48f96ab59 100644
--- a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj
+++ b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj
@@ -1,11 +1,11 @@
- netstandard1.5
+ netstandard2.0
-
+
diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj
index 1fc8e48cf..22a2d3091 100644
--- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj
+++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj
@@ -1,7 +1,7 @@
- netstandard1.5
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks.EventBus
diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
index 07a130f22..f438623a6 100644
--- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
+++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
@@ -11,10 +11,7 @@ using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions;
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net.Sockets;
-using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@@ -184,7 +181,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
};
channel.BasicConsume(queue: _queueName,
- noAck: true,
+ autoAck: false,
consumer: consumer);
channel.CallbackException += (sender, ea) =>
diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
index f033ad159..6966a57f1 100644
--- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
+++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
@@ -1,17 +1,17 @@
- netstandard1.5
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
-
-
+
+
-
-
-
+
+
+
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs
index db1b6b390..a3f563c2f 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs
@@ -1,7 +1,6 @@
using Microsoft.Azure.ServiceBus;
using Microsoft.Extensions.Logging;
using System;
-using System.IO;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
index 1458b7198..03a3d1139 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
@@ -9,7 +9,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
- using System.Reflection;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
index 1db35be68..07c7a7607 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
@@ -1,14 +1,14 @@
- netcoreapp1.1
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
-
+
-
+
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs
index 283031247..52737cef7 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs
@@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{
- using System;
using Microsoft.Azure.ServiceBus;
+ using System;
public interface IServiceBusPersisterConnection : IDisposable
{
diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
index e1e24b9fe..8d5c8f0ad 100644
--- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
+++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
@@ -1,22 +1,21 @@
- netcoreapp2.0
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
-
-
-
-
-
-
+
+
+
+
+
-
+
diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj
index 023554e60..0f6b99f32 100644
--- a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj
+++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj
@@ -1,7 +1,7 @@
- netstandard1.3
+ netstandard2.0
@@ -9,7 +9,7 @@
-
+
diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj
index 24d5ce92b..110ef7497 100644
--- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj
+++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj
@@ -1,7 +1,7 @@
- netstandard1.3
+ netstandard2.0
$(PackageTargetFallback);net46
false
false
@@ -17,11 +17,11 @@
-
+
-
-
+
+
diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj
index 35aacef13..60017a85f 100644
--- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj
+++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj
@@ -1,7 +1,7 @@
- netstandard1.3
+ netstandard2.0
@@ -9,7 +9,7 @@
-
+
diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj
index 8ef22e156..80e8026b0 100644
--- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj
+++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj
@@ -1,7 +1,7 @@
- netstandard1.3
+ netstandard2.0
@@ -9,7 +9,7 @@
-
+
diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj
index 1f094380c..e1c32cff2 100644
--- a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj
+++ b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj
@@ -1,14 +1,14 @@
- netstandard1.4
+ netstandard2.0
Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
-
+
-
+
\ No newline at end of file
diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj
index c418c56a5..8864c9d06 100644
--- a/src/Services/Basket/Basket.API/Basket.API.csproj
+++ b/src/Services/Basket/Basket.API/Basket.API.csproj
@@ -16,24 +16,9 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs
index 9219cfad3..dff9ba54a 100644
--- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs
+++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs
@@ -1,15 +1,12 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.eShopOnContainers.Services.Basket.API.Model;
+using Basket.API.IntegrationEvents.Events;
+using Basket.API.Model;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
-using Basket.API.IntegrationEvents.Events;
+using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.eShopOnContainers.Services.Basket.API.Services;
-using Basket.API.Model;
+using System;
+using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
{
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs
index 199409ecc..e0f2df6fa 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Exceptions
{
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs
index 935bb79a8..a09f32f76 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs
@@ -1,8 +1,5 @@
using Microsoft.AspNetCore.Builder;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Middlewares
{
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
index f27a3c209..7caa9740d 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
@@ -1,10 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Filters
{
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs
index 8ef72edb6..3e4c3e072 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs
@@ -1,6 +1,6 @@
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
+using System.Linq;
namespace Basket.API.Infrastructure.Filters
{
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs
index 05acd0d2c..875749b5f 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Http;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
diff --git a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs
index b31207e00..45989832c 100644
--- a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs
+++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Basket.API.Infrastructure.Middlewares
{
diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs
index f6e7de1b0..19ae1b594 100644
--- a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs
+++ b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs
@@ -1,6 +1,5 @@
using Basket.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
-using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using System;
using System.Threading.Tasks;
diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs b/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
index 4c02612c5..e3665451c 100644
--- a/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
+++ b/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
@@ -1,9 +1,6 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Basket.API.IntegrationEvents.Events
{
diff --git a/src/Services/Basket/Basket.API/Model/BasketCheckout.cs b/src/Services/Basket/Basket.API/Model/BasketCheckout.cs
index 5241a3672..410700773 100644
--- a/src/Services/Basket/Basket.API/Model/BasketCheckout.cs
+++ b/src/Services/Basket/Basket.API/Model/BasketCheckout.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Basket.API.Model
{
diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs
index 7753ef537..53b6f311f 100644
--- a/src/Services/Basket/Basket.API/Program.cs
+++ b/src/Services/Basket/Basket.API/Program.cs
@@ -1,7 +1,8 @@
using Basket.API.Infrastructure.Middlewares;
+using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
-using System.Collections.Generic;
+using Microsoft.Extensions.Logging;
using System.IO;
namespace Microsoft.eShopOnContainers.Services.Basket.API
@@ -10,19 +11,24 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
+ BuildWebHost(args).Run();
+ }
+
+ public static IWebHost BuildWebHost(string[] args) =>
+ WebHost.CreateDefaultBuilder(args)
.UseFailing(options =>
{
- options.ConfigPath = "/Failing";
+ options.ConfigPath = "/Failing";
})
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
- .UseIISIntegration()
.UseStartup()
+ .ConfigureLogging((hostingContext, builder) =>
+ {
+ builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
+ builder.AddConsole();
+ builder.AddDebug();
+ })
.Build();
-
- host.Run();
- }
}
}
diff --git a/src/Services/Basket/Basket.API/Services/IIdentityService.cs b/src/Services/Basket/Basket.API/Services/IIdentityService.cs
index 8cc7bd848..fe84e23d5 100644
--- a/src/Services/Basket/Basket.API/Services/IIdentityService.cs
+++ b/src/Services/Basket/Basket.API/Services/IIdentityService.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Microsoft.eShopOnContainers.Services.Basket.API.Services
+namespace Microsoft.eShopOnContainers.Services.Basket.API.Services
{
public interface IIdentityService
{
diff --git a/src/Services/Basket/Basket.API/Services/IdentityService.cs b/src/Services/Basket/Basket.API/Services/IdentityService.cs
index 08d1ffffa..d187be8d6 100644
--- a/src/Services/Basket/Basket.API/Services/IdentityService.cs
+++ b/src/Services/Basket/Basket.API/Services/IdentityService.cs
@@ -1,9 +1,6 @@
using Microsoft.AspNetCore.Http;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Services
{
diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs
index 18e21e209..e2a2b6e3e 100644
--- a/src/Services/Basket/Basket.API/Startup.cs
+++ b/src/Services/Basket/Basket.API/Startup.cs
@@ -6,10 +6,11 @@ using Basket.API.IntegrationEvents.Events;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
+using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
-using Microsoft.eShopOnContainers.Services.Basket.API.Auth.Server;
+using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
@@ -21,31 +22,22 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using RabbitMQ.Client;
using StackExchange.Redis;
-using System;
-using System.Linq;
-using System.Net;
-using System.Threading.Tasks;
-
-using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
-using Microsoft.Azure.ServiceBus;
using Swashbuckle.AspNetCore.Swagger;
+using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API
{
public class Startup
{
- public Startup(IHostingEnvironment env)
+ public Startup(IConfiguration configuration)
{
- var builder = new ConfigurationBuilder()
- .SetBasePath(env.ContentRootPath)
- .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
- .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
- .AddEnvironmentVariables();
- Configuration = builder.Build();
+ Configuration = configuration;
}
- public IConfigurationRoot Configuration { get; }
+ public IConfiguration Configuration { get; }
+
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
@@ -55,6 +47,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
options.Filters.Add(typeof(ValidateModelStateFilter));
+
}).AddControllersAsServices();
services.AddHealthChecks(checks =>
@@ -66,6 +59,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.Configure(Configuration);
+ services.AddAuthentication()
+ .AddJwtBearer(options =>
+ {
+ options.Authority = Configuration.GetValue("IdentityUrl");
+ options.Audience = "basket";
+ options.RequireHttpsMetadata = false;
+
+ });
+
//By connecting here we are making sure that our service
//cannot start until redis is ready. This might slow down startup,
//but given that there is a delay on resolving the ip address
@@ -75,7 +77,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton(sp =>
{
var settings = sp.GetRequiredService>().Value;
- ConfigurationOptions configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
+ var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
+
configuration.ResolveDns = true;
return ConnectionMultiplexer.Connect(configuration);
@@ -111,11 +114,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
RegisterEventBus(services);
-
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
- options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
+ options.SwaggerDoc("v1", new Info
{
Title = "Basket HTTP API",
Version = "v1",
@@ -154,9 +156,32 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
var container = new ContainerBuilder();
container.Populate(services);
+
return new AutofacServiceProvider(container.Build());
}
+
+
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
+ {
+ app.UseStaticFiles();
+ app.UseCors("CorsPolicy");
+ app.UseAuthentication();
+ app.UseMvcWithDefaultRoute();
+
+ app.UseSwagger()
+ .UseSwaggerUI(c =>
+ {
+ c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
+ c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI");
+ });
+
+ ConfigureEventBus(app);
+
+ }
+
+
private void RegisterEventBus(IServiceCollection services)
{
if (Configuration.GetValue("AzureServiceBusEnabled"))
@@ -169,7 +194,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
var eventBusSubcriptionsManager = sp.GetRequiredService();
var subscriptionClientName = Configuration["SubscriptionClientName"];
- return new EventBusServiceBus(serviceBusPersisterConnection, logger,
+ return new EventBusServiceBus(serviceBusPersisterConnection, logger,
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
});
}
@@ -184,46 +209,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddTransient();
}
- // 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)
- {
- loggerFactory.AddConsole(Configuration.GetSection("Logging"));
- loggerFactory.AddDebug();
-
- app.UseStaticFiles();
-
- // Use frameworks
- app.UseCors("CorsPolicy");
-
- ConfigureAuth(app);
-
- app.UseMvcWithDefaultRoute();
-
- app.UseSwagger()
- .UseSwaggerUI(c =>
- {
- c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
- c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI");
- });
-
- ConfigureEventBus(app);
-
- }
-
- protected virtual void ConfigureAuth(IApplicationBuilder app)
- {
- var identityUrl = Configuration.GetValue("IdentityUrl");
- app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
- {
- Authority = identityUrl.ToString(),
- ApiName = "basket",
- RequireHttpsMetadata = false
- });
- }
-
- protected virtual void ConfigureEventBus(IApplicationBuilder app)
+ private void ConfigureEventBus(IApplicationBuilder app)
{
var eventBus = app.ApplicationServices.GetRequiredService();
+
eventBus.Subscribe();
eventBus.Subscribe();
}
diff --git a/src/Services/Location/Locations.API/Controllers/HomeController.cs b/src/Services/Location/Locations.API/Controllers/HomeController.cs
index e7cea3cca..15cb07404 100644
--- a/src/Services/Location/Locations.API/Controllers/HomeController.cs
+++ b/src/Services/Location/Locations.API/Controllers/HomeController.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
diff --git a/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs b/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs
index e2d7f9ea2..cd50fa987 100644
--- a/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs
+++ b/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs
@@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories
{
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
- using ViewModel;
using System.Collections.Generic;
using System.Threading.Tasks;
+ using ViewModel;
public interface ILocationsRepository
{
diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs
index 81bc16489..771a075d2 100644
--- a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs
+++ b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs
@@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services
{
- using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
+ using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
using System;
diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj
index 90588c8f7..b1b322708 100644
--- a/src/Services/Location/Locations.API/Locations.API.csproj
+++ b/src/Services/Location/Locations.API/Locations.API.csproj
@@ -11,22 +11,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -35,10 +20,7 @@
-
-
-
-
+
diff --git a/src/Services/Location/Locations.API/Model/Locations.cs b/src/Services/Location/Locations.API/Model/Locations.cs
index df521b9b7..7c0580fc6 100644
--- a/src/Services/Location/Locations.API/Model/Locations.cs
+++ b/src/Services/Location/Locations.API/Model/Locations.cs
@@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model
{
using MongoDB.Bson;
+ using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver.GeoJsonObjectModel;
using System.Collections.Generic;
- using MongoDB.Bson.Serialization.Attributes;
public class Locations
{
diff --git a/src/Services/Location/Locations.API/Program.cs b/src/Services/Location/Locations.API/Program.cs
index 8a4a486cb..7ebc0ab8a 100644
--- a/src/Services/Location/Locations.API/Program.cs
+++ b/src/Services/Location/Locations.API/Program.cs
@@ -1,6 +1,8 @@
-using System.IO;
+using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Logging;
+using System.IO;
namespace Microsoft.eShopOnContainers.Services.Locations.API
{
@@ -8,14 +10,19 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
+ BuildWebHost(args).Run();
+ }
+
+ public static IWebHost BuildWebHost(string[] args) =>
+ WebHost.CreateDefaultBuilder(args)
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup()
- .Build();
-
- host.Run();
- }
+ .ConfigureLogging((hostingContext, builder) =>
+ {
+ builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
+ builder.AddConsole();
+ builder.AddDebug();
+ }).Build();
}
}
diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs
index 34fd8cb75..7d235ed0f 100644
--- a/src/Services/Location/Locations.API/Startup.cs
+++ b/src/Services/Location/Locations.API/Startup.cs
@@ -3,58 +3,51 @@ using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
+using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
+using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;
-using System.Reflection;
+using Swashbuckle.AspNetCore.Swagger;
using System;
-using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
-using Microsoft.Azure.ServiceBus;
using System.Collections.Generic;
-using Swashbuckle.AspNetCore.Swagger;
-using Microsoft.Extensions.HealthChecks;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Locations.API
{
public class Startup
{
- public IConfigurationRoot Configuration { get; }
-
- public Startup(IHostingEnvironment env)
+ public Startup(IConfiguration configuration)
{
- var builder = new ConfigurationBuilder()
- .SetBasePath(env.ContentRootPath)
- .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
- .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
-
- if (env.IsDevelopment())
- {
- builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly);
- }
-
- builder.AddEnvironmentVariables();
-
- Configuration = builder.Build();
+ Configuration = configuration;
}
- // This method gets called by the runtime. Use this method to add services to the container.
+ public IConfiguration Configuration { get; }
+
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- // Add framework services.
services.AddMvc(options =>
{
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
}).AddControllersAsServices();
+ services.AddAuthentication()
+ .AddJwtBearer(options =>
+ {
+ options.Authority = Configuration.GetValue("IdentityUrl");
+ options.Audience = "locations";
+ options.RequireHttpsMetadata = false;
+ });
+
services.Configure(Configuration);
if (Configuration.GetValue("AzureServiceBusEnabled"))
@@ -143,14 +136,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
// 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)
{
- //Configure logs
-
- loggerFactory.AddConsole(Configuration.GetSection("Logging"));
- loggerFactory.AddDebug();
-
app.UseCors("CorsPolicy");
- ConfigureAuth(app);
+ app.UseAuthentication();
app.UseMvcWithDefaultRoute();
@@ -165,17 +153,6 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.Wait();
}
- protected virtual void ConfigureAuth(IApplicationBuilder app)
- {
- var identityUrl = Configuration.GetValue("IdentityUrl");
- app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
- {
- Authority = identityUrl.ToString(),
- ApiName = "locations",
- RequireHttpsMetadata = false
- });
- }
-
private void RegisterEventBus(IServiceCollection services)
{
if (Configuration.GetValue("AzureServiceBusEnabled"))
diff --git a/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs b/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs
index 8619bfc0f..5301cee87 100644
--- a/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs
+++ b/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Microsoft.eShopOnContainers.Services.Locations.API.ViewModel
+namespace Microsoft.eShopOnContainers.Services.Locations.API.ViewModel
{
public class LocationRequest
{
diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj
index 71adef034..b834eab2d 100644
--- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj
+++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj
@@ -18,28 +18,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -47,10 +26,7 @@
-
-
-
-
+
diff --git a/src/Services/Marketing/Marketing.API/Program.cs b/src/Services/Marketing/Marketing.API/Program.cs
index dbde65b27..197573518 100644
--- a/src/Services/Marketing/Marketing.API/Program.cs
+++ b/src/Services/Marketing/Marketing.API/Program.cs
@@ -1,21 +1,28 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API
{
- using System.IO;
using AspNetCore.Hosting;
+ using Microsoft.AspNetCore;
+ using Microsoft.Extensions.Logging;
+ using System.IO;
public class Program
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
+ BuildWebHost(args).Run();
+ }
+
+ public static IWebHost BuildWebHost(string[] args) =>
+ WebHost.CreateDefaultBuilder(args)
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup()
.UseWebRoot("Pics")
- .Build();
-
- host.Run();
- }
+ .ConfigureLogging((hostingContext, builder) =>
+ {
+ builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
+ builder.AddConsole();
+ builder.AddDebug();
+ }).Build();
}
}
diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs
index e5fa1a451..3a7eab78a 100644
--- a/src/Services/Marketing/Marketing.API/Startup.cs
+++ b/src/Services/Marketing/Marketing.API/Startup.cs
@@ -1,58 +1,45 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API
{
- using Autofac;
- using Autofac.Extensions.DependencyInjection;
- using IntegrationEvents.Events;
using AspNetCore.Builder;
using AspNetCore.Hosting;
using AspNetCore.Http;
+ using Autofac;
+ using Autofac.Extensions.DependencyInjection;
using Azure.ServiceBus;
- using EntityFrameworkCore;
- using EntityFrameworkCore.Infrastructure;
using BuildingBlocks.EventBus;
using BuildingBlocks.EventBus.Abstractions;
using BuildingBlocks.EventBusRabbitMQ;
using BuildingBlocks.EventBusServiceBus;
+ using EntityFrameworkCore;
+ using Extensions.Configuration;
+ using Extensions.DependencyInjection;
+ using Extensions.HealthChecks;
+ using Extensions.Logging;
using Infrastructure;
using Infrastructure.Filters;
using Infrastructure.Repositories;
using Infrastructure.Services;
- using Extensions.Configuration;
- using Extensions.DependencyInjection;
- using Extensions.Logging;
+ using IntegrationEvents.Events;
+ using Marketing.API.IntegrationEvents.Handlers;
+ using Microsoft.EntityFrameworkCore.Diagnostics;
using Polly;
using RabbitMQ.Client;
+ using Swashbuckle.AspNetCore.Swagger;
using System;
+ using System.Collections.Generic;
using System.Data.SqlClient;
using System.Reflection;
using System.Threading.Tasks;
- using Extensions.HealthChecks;
- using Marketing.API.IntegrationEvents.Handlers;
- using Microsoft.EntityFrameworkCore.Diagnostics;
- using Swashbuckle.AspNetCore.Swagger;
- using System.Collections.Generic;
public class Startup
{
- public Startup(IHostingEnvironment env)
+ public Startup(IConfiguration configuration)
{
- var builder = new ConfigurationBuilder()
- .SetBasePath(env.ContentRootPath)
- .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
- .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
- .AddEnvironmentVariables();
-
- if (env.IsDevelopment())
- {
- builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly);
- }
-
- builder.AddEnvironmentVariables();
-
- Configuration = builder.Build();
+ Configuration = configuration;
}
- public IConfigurationRoot Configuration { get; }
+ public IConfiguration Configuration { get; }
+
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
@@ -65,6 +52,14 @@
services.Configure(Configuration);
+ services.AddAuthentication()
+ .AddJwtBearer(options =>
+ {
+ options.Authority = Configuration.GetValue("IdentityUrl");
+ options.Audience = "marketing";
+ options.RequireHttpsMetadata = false;
+ });
+
services.AddHealthChecks(checks =>
{
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok")));
@@ -179,7 +174,7 @@
app.UseCors("CorsPolicy");
- ConfigureAuth(app);
+ app.UseAuthentication();
app.UseMvcWithDefaultRoute();
@@ -198,17 +193,6 @@
ConfigureEventBus(app);
}
- protected virtual void ConfigureAuth(IApplicationBuilder app)
- {
- var identityUrl = Configuration.GetValue("IdentityUrl");
- app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
- {
- Authority = identityUrl.ToString(),
- ApiName = "marketing",
- RequireHttpsMetadata = false
- });
- }
-
private void RegisterEventBus(IServiceCollection services)
{
if (Configuration.GetValue("AzureServiceBusEnabled"))