Browse Source

Merge branch 'netcore2' of https://github.com/dotnet-architecture/eShopOnContainers into netcore2

pull/300/head
Ramón Tomás 7 years ago
parent
commit
e41531ae8c
41 changed files with 188 additions and 326 deletions
  1. +3
    -9
      src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj
  2. +2
    -2
      src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj
  3. +1
    -1
      src/BuildingBlocks/EventBus/EventBus/EventBus.csproj
  4. +1
    -4
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
  5. +6
    -6
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
  6. +0
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs
  7. +0
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
  8. +3
    -3
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
  9. +1
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs
  10. +7
    -8
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
  11. +2
    -2
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj
  12. +4
    -4
      src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj
  13. +2
    -2
      src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj
  14. +2
    -2
      src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj
  15. +3
    -3
      src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj
  16. +1
    -16
      src/Services/Basket/Basket.API/Basket.API.csproj
  17. +6
    -9
      src/Services/Basket/Basket.API/Controllers/BasketController.cs
  18. +0
    -3
      src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs
  19. +0
    -3
      src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs
  20. +0
    -2
      src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
  21. +2
    -2
      src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs
  22. +0
    -1
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs
  23. +1
    -4
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs
  24. +0
    -1
      src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs
  25. +0
    -3
      src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
  26. +0
    -3
      src/Services/Basket/Basket.API/Model/BasketCheckout.cs
  27. +14
    -8
      src/Services/Basket/Basket.API/Program.cs
  28. +1
    -6
      src/Services/Basket/Basket.API/Services/IIdentityService.cs
  29. +0
    -3
      src/Services/Basket/Basket.API/Services/IdentityService.cs
  30. +47
    -58
      src/Services/Basket/Basket.API/Startup.cs
  31. +1
    -5
      src/Services/Location/Locations.API/Controllers/HomeController.cs
  32. +1
    -1
      src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs
  33. +1
    -1
      src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs
  34. +2
    -20
      src/Services/Location/Locations.API/Locations.API.csproj
  35. +1
    -1
      src/Services/Location/Locations.API/Model/Locations.cs
  36. +14
    -7
      src/Services/Location/Locations.API/Program.cs
  37. +17
    -40
      src/Services/Location/Locations.API/Startup.cs
  38. +1
    -6
      src/Services/Location/Locations.API/ViewModel/LocationRequest.cs
  39. +2
    -26
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  40. +14
    -7
      src/Services/Marketing/Marketing.API/Program.cs
  41. +25
    -41
      src/Services/Marketing/Marketing.API/Startup.cs

+ 3
- 9
src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj View File

@ -1,19 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks</RootNamespace>
<!--
<NetStandardImplicitPackageVersion>2.0.0-preview1-25301-01</NetStandardImplicitPackageVersion>
-->
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="1.1.2" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="1.1.2" />
<!--
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="2.0.0-preview2-final" />
-->
<PackageReference Include="StackExchange.Redis" Version="1.2.3" />
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 2
- 2
src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit" Version="2.2.0" /> <PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup> </ItemGroup>


+ 1
- 1
src/BuildingBlocks/EventBus/EventBus/EventBus.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBus</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBus</RootNamespace>
</PropertyGroup> </PropertyGroup>


+ 1
- 4
src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs View File

@ -11,10 +11,7 @@ using RabbitMQ.Client;
using RabbitMQ.Client.Events; using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions; using RabbitMQ.Client.Exceptions;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -184,7 +181,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
}; };
channel.BasicConsume(queue: _queueName, channel.BasicConsume(queue: _queueName,
noAck: true,
autoAck: false,
consumer: consumer); consumer: consumer);
channel.CallbackException += (sender, ea) => channel.CallbackException += (sender, ea) =>


+ 6
- 6
src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj View File

@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Autofac" Version="4.6.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Polly" Version="5.2.0" />
<PackageReference Include="RabbitMQ.Client" Version="4.1.3" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
<PackageReference Include="Polly" Version="5.3.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.0.1" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 0
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs View File

@ -1,7 +1,6 @@
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.IO;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{ {


+ 0
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs View File

@ -9,7 +9,6 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;


+ 3
- 3
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac" Version="4.5.0" />
<PackageReference Include="Autofac" Version="4.6.1" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="1.0.0" /> <PackageReference Include="Microsoft.Azure.ServiceBus" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 1
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{ {
using System;
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
using System;
public interface IServiceBusPersisterConnection : IDisposable public interface IServiceBusPersisterConnection : IDisposable
{ {


+ 7
- 8
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj View File

@ -1,22 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 2
- 2
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -9,7 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.0" />
<ProjectReference Include="..\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" /> <ProjectReference Include="..\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
</ItemGroup> </ItemGroup>

+ 4
- 4
src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);net46</PackageTargetFallback> <PackageTargetFallback>$(PackageTargetFallback);net46</PackageTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
@ -17,11 +17,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.0" />
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" /> <PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />
<PackageReference Include="System.Threading.Thread" Version="4.3.0" /> <PackageReference Include="System.Threading.Thread" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.3.0" />
<PackageReference Include="WindowsAzure.Storage" Version="7.2.1" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.4.0" />
<PackageReference Include="WindowsAzure.Storage" Version="8.4.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 2
- 2
src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -9,7 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.3.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 2
- 2
src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -9,7 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" /> <PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" /> <PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />


+ 3
- 3
src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Polly" Version="5.2.0" />
<PackageReference Include="Polly" Version="5.3.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 1
- 16
src/Services/Basket/Basket.API/Basket.API.csproj View File

@ -16,24 +16,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="StackExchange.Redis" Version="1.2.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="StackExchange.Redis" Version="1.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 6
- 9
src/Services/Basket/Basket.API/Controllers/BasketController.cs View File

@ -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.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; 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 Microsoft.eShopOnContainers.Services.Basket.API.Services;
using Basket.API.Model;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
{ {


+ 0
- 3
src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs View File

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Exceptions namespace Basket.API.Infrastructure.Exceptions
{ {


+ 0
- 3
src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs View File

@ -1,8 +1,5 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Middlewares namespace Basket.API.Infrastructure.Middlewares
{ {


+ 0
- 2
src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs View File

@ -1,10 +1,8 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Filters namespace Basket.API.Infrastructure.Filters
{ {


+ 2
- 2
src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs View File

@ -1,6 +1,6 @@
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using System.Linq;
namespace Basket.API.Infrastructure.Filters namespace Basket.API.Infrastructure.Filters
{ {


+ 0
- 1
src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;


+ 1
- 4
src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs View File

@ -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 namespace Basket.API.Infrastructure.Middlewares
{ {


+ 0
- 1
src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs View File

@ -1,6 +1,5 @@
using Basket.API.IntegrationEvents.Events; using Basket.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model; using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;


+ 0
- 3
src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs View File

@ -1,9 +1,6 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model; using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Basket.API.IntegrationEvents.Events namespace Basket.API.IntegrationEvents.Events
{ {


+ 0
- 3
src/Services/Basket/Basket.API/Model/BasketCheckout.cs View File

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Basket.API.Model namespace Basket.API.Model
{ {


+ 14
- 8
src/Services/Basket/Basket.API/Program.cs View File

@ -1,7 +1,8 @@
using Basket.API.Infrastructure.Middlewares; using Basket.API.Infrastructure.Middlewares;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using System.IO; using System.IO;
namespace Microsoft.eShopOnContainers.Services.Basket.API namespace Microsoft.eShopOnContainers.Services.Basket.API
@ -10,19 +11,24 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{ {
public static void Main(string[] args) 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 => .UseFailing(options =>
{ {
options.ConfigPath = "/Failing";
options.ConfigPath = "/Failing";
}) })
.UseHealthChecks("/hc") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.Build(); .Build();
host.Run();
}
} }
} }

+ 1
- 6
src/Services/Basket/Basket.API/Services/IIdentityService.cs View File

@ -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 public interface IIdentityService
{ {


+ 0
- 3
src/Services/Basket/Basket.API/Services/IdentityService.cs View File

@ -1,9 +1,6 @@
 
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System; 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
{ {


+ 47
- 58
src/Services/Basket/Basket.API/Startup.cs View File

@ -6,10 +6,11 @@ using Basket.API.IntegrationEvents.Events;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; 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.EventHandling;
using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.Services.Basket.API.Model; using Microsoft.eShopOnContainers.Services.Basket.API.Model;
@ -21,31 +22,22 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using RabbitMQ.Client; using RabbitMQ.Client;
using StackExchange.Redis; 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 Swashbuckle.AspNetCore.Swagger;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Basket.API namespace Microsoft.eShopOnContainers.Services.Basket.API
{ {
public class Startup 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. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
@ -55,6 +47,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{ {
options.Filters.Add(typeof(HttpGlobalExceptionFilter)); options.Filters.Add(typeof(HttpGlobalExceptionFilter));
options.Filters.Add(typeof(ValidateModelStateFilter)); options.Filters.Add(typeof(ValidateModelStateFilter));
}).AddControllersAsServices(); }).AddControllersAsServices();
services.AddHealthChecks(checks => services.AddHealthChecks(checks =>
@ -66,6 +59,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.Configure<BasketSettings>(Configuration); services.Configure<BasketSettings>(Configuration);
services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "basket";
options.RequireHttpsMetadata = false;
});
//By connecting here we are making sure that our service //By connecting here we are making sure that our service
//cannot start until redis is ready. This might slow down startup, //cannot start until redis is ready. This might slow down startup,
//but given that there is a delay on resolving the ip address //but given that there is a delay on resolving the ip address
@ -75,7 +77,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton<ConnectionMultiplexer>(sp => services.AddSingleton<ConnectionMultiplexer>(sp =>
{ {
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value; var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
ConfigurationOptions configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
configuration.ResolveDns = true; configuration.ResolveDns = true;
return ConnectionMultiplexer.Connect(configuration); return ConnectionMultiplexer.Connect(configuration);
@ -111,11 +114,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
RegisterEventBus(services); RegisterEventBus(services);
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
options.SwaggerDoc("v1", new Info
{ {
Title = "Basket HTTP API", Title = "Basket HTTP API",
Version = "v1", Version = "v1",
@ -154,9 +156,32 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
var container = new ContainerBuilder(); var container = new ContainerBuilder();
container.Populate(services); container.Populate(services);
return new AutofacServiceProvider(container.Build()); 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) private void RegisterEventBus(IServiceCollection services)
{ {
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
@ -169,7 +194,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>(); var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
var subscriptionClientName = Configuration["SubscriptionClientName"]; var subscriptionClientName = Configuration["SubscriptionClientName"];
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
}); });
} }
@ -184,46 +209,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddTransient<OrderStartedIntegrationEventHandler>(); services.AddTransient<OrderStartedIntegrationEventHandler>();
} }
// 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<string>("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<IEventBus>(); var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>(); eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>();
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>(); eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>();
} }


+ 1
- 5
src/Services/Location/Locations.API/Controllers/HomeController.cs View File

@ -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 // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860


+ 1
- 1
src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs View File

@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories
{ {
using Microsoft.eShopOnContainers.Services.Locations.API.Model; using Microsoft.eShopOnContainers.Services.Locations.API.Model;
using ViewModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using ViewModel;
public interface ILocationsRepository public interface ILocationsRepository
{ {


+ 1
- 1
src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs View File

@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services 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.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; 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.Model;
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel; using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
using System; using System;


+ 2
- 20
src/Services/Location/Locations.API/Locations.API.csproj View File

@ -11,22 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.0-beta6" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" /> <PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" /> <PackageReference Include="MongoDB.Bson" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver" Version="2.4.4" /> <PackageReference Include="MongoDB.Driver" Version="2.4.4" />
@ -35,10 +20,7 @@
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />


+ 1
- 1
src/Services/Location/Locations.API/Model/Locations.cs View File

@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model namespace Microsoft.eShopOnContainers.Services.Locations.API.Model
{ {
using MongoDB.Bson; using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver.GeoJsonObjectModel; using MongoDB.Driver.GeoJsonObjectModel;
using System.Collections.Generic; using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
public class Locations public class Locations
{ {


+ 14
- 7
src/Services/Location/Locations.API/Program.cs View File

@ -1,6 +1,8 @@
using System.IO;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using System.IO;
namespace Microsoft.eShopOnContainers.Services.Locations.API namespace Microsoft.eShopOnContainers.Services.Locations.API
{ {
@ -8,14 +10,19 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
{ {
public static void Main(string[] args) 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") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>() .UseStartup<Startup>()
.Build();
host.Run();
}
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
} }
} }

+ 17
- 40
src/Services/Location/Locations.API/Startup.cs View File

@ -3,58 +3,51 @@ using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using RabbitMQ.Client; using RabbitMQ.Client;
using System.Reflection;
using Swashbuckle.AspNetCore.Swagger;
using System; using System;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.Azure.ServiceBus;
using System.Collections.Generic; using System.Collections.Generic;
using Swashbuckle.AspNetCore.Swagger;
using Microsoft.Extensions.HealthChecks;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Locations.API namespace Microsoft.eShopOnContainers.Services.Locations.API
{ {
public class Startup 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) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
// Add framework services.
services.AddMvc(options => services.AddMvc(options =>
{ {
options.Filters.Add(typeof(HttpGlobalExceptionFilter)); options.Filters.Add(typeof(HttpGlobalExceptionFilter));
}).AddControllersAsServices(); }).AddControllersAsServices();
services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "locations";
options.RequireHttpsMetadata = false;
});
services.Configure<LocationSettings>(Configuration); services.Configure<LocationSettings>(Configuration);
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("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. // 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) public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{ {
//Configure logs
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
ConfigureAuth(app);
app.UseAuthentication();
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();
@ -165,17 +153,6 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.Wait(); .Wait();
} }
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = identityUrl.ToString(),
ApiName = "locations",
RequireHttpsMetadata = false
});
}
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)
{ {
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))


+ 1
- 6
src/Services/Location/Locations.API/ViewModel/LocationRequest.cs View File

@ -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 public class LocationRequest
{ {


+ 2
- 26
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -18,28 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" /> <PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" /> <PackageReference Include="MongoDB.Bson" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver" Version="2.4.4" /> <PackageReference Include="MongoDB.Driver" Version="2.4.4" />
@ -47,10 +26,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />


+ 14
- 7
src/Services/Marketing/Marketing.API/Program.cs View File

@ -1,21 +1,28 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API namespace Microsoft.eShopOnContainers.Services.Marketing.API
{ {
using System.IO;
using AspNetCore.Hosting; using AspNetCore.Hosting;
using Microsoft.AspNetCore;
using Microsoft.Extensions.Logging;
using System.IO;
public class Program public class Program
{ {
public static void Main(string[] args) 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") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>() .UseStartup<Startup>()
.UseWebRoot("Pics") .UseWebRoot("Pics")
.Build();
host.Run();
}
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
} }
} }

+ 25
- 41
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -1,58 +1,45 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API namespace Microsoft.eShopOnContainers.Services.Marketing.API
{ {
using Autofac;
using Autofac.Extensions.DependencyInjection;
using IntegrationEvents.Events;
using AspNetCore.Builder; using AspNetCore.Builder;
using AspNetCore.Hosting; using AspNetCore.Hosting;
using AspNetCore.Http; using AspNetCore.Http;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Azure.ServiceBus; using Azure.ServiceBus;
using EntityFrameworkCore;
using EntityFrameworkCore.Infrastructure;
using BuildingBlocks.EventBus; using BuildingBlocks.EventBus;
using BuildingBlocks.EventBus.Abstractions; using BuildingBlocks.EventBus.Abstractions;
using BuildingBlocks.EventBusRabbitMQ; using BuildingBlocks.EventBusRabbitMQ;
using BuildingBlocks.EventBusServiceBus; using BuildingBlocks.EventBusServiceBus;
using EntityFrameworkCore;
using Extensions.Configuration;
using Extensions.DependencyInjection;
using Extensions.HealthChecks;
using Extensions.Logging;
using Infrastructure; using Infrastructure;
using Infrastructure.Filters; using Infrastructure.Filters;
using Infrastructure.Repositories; using Infrastructure.Repositories;
using Infrastructure.Services; 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 Polly;
using RabbitMQ.Client; using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger;
using System; using System;
using System.Collections.Generic;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; 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 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. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
@ -65,6 +52,14 @@
services.Configure<MarketingSettings>(Configuration); services.Configure<MarketingSettings>(Configuration);
services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "marketing";
options.RequireHttpsMetadata = false;
});
services.AddHealthChecks(checks => services.AddHealthChecks(checks =>
{ {
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok"))); checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
@ -179,7 +174,7 @@
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
ConfigureAuth(app);
app.UseAuthentication();
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();
@ -198,17 +193,6 @@
ConfigureEventBus(app); ConfigureEventBus(app);
} }
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = identityUrl.ToString(),
ApiName = "marketing",
RequireHttpsMetadata = false
});
}
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)
{ {
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))


Loading…
Cancel
Save