Browse Source

Merge pull request #1559 from borjasanes/feature/webapps-net5-migration

Feature/webapps net5 migration
pull/1566/head
Miguel Veloso 4 years ago
committed by GitHub
parent
commit
3434459888
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 500 additions and 726 deletions
  1. +0
    -76
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs
  2. +0
    -78
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs
  3. +3
    -3
      src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj
  4. +1
    -1
      src/BuildingBlocks/EventBus/EventBus/EventBus.csproj
  5. +3
    -3
      src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs
  6. +1
    -1
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
  7. +5
    -5
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
  8. +4
    -4
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
  9. +5
    -5
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
  10. +9
    -8
      src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj
  11. +1
    -1
      src/Services/Basket/Basket.API/Basket.API.csproj
  12. +2
    -2
      src/Services/Basket/Basket.API/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs
  13. +4
    -4
      src/Services/Basket/Basket.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs
  14. +14
    -14
      src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
  15. +12
    -12
      src/Services/Basket/Basket.API/Model/BasketCheckout.cs
  16. +6
    -6
      src/Services/Basket/Basket.API/Model/BasketItem.cs
  17. +2
    -2
      src/Services/Basket/Basket.API/Model/CustomerBasket.cs
  18. +2
    -2
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs
  19. +1
    -1
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs
  20. +1
    -1
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs
  21. +2
    -2
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs
  22. +4
    -4
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs
  23. +4
    -4
      src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj
  24. +5
    -5
      src/Services/Catalog/Catalog.UnitTests/Catalog.UnitTests.csproj
  25. +17
    -16
      src/Services/Identity/Identity.API/Identity.API.csproj
  26. +0
    -1
      src/Services/Identity/Identity.API/Startup.cs
  27. +1
    -1
      src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommand.cs
  28. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs
  29. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderPaymentFailedIntegrationEvent .cs
  30. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderPaymentSucceededIntegrationEvent.cs
  31. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs
  32. +2
    -2
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs
  33. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToCancelledIntegrationEvent.cs
  34. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs
  35. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToShippedIntegrationEvent.cs
  36. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs
  37. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedTosubmittedIntegrationEvent.cs
  38. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs
  39. +2
    -2
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs
  40. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs
  41. +1
    -1
      src/Services/Ordering/Ordering.API/Ordering.API.csproj
  42. +1
    -1
      src/Services/Ordering/Ordering.BackgroundTasks/Events/GracePeriodConfirmedIntegrationEvent.cs
  43. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs
  44. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToCancelledIntegrationEvent.cs
  45. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs
  46. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToShippedIntegrationEvent.cs
  47. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs
  48. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToSubmittedIntegrationEvent.cs
  49. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj
  50. +1
    -1
      src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderPaymentFailedIntegrationEvent.cs
  51. +1
    -1
      src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderPaymentSucceededIntegrationEvent.cs
  52. +1
    -1
      src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs
  53. +2
    -2
      src/Services/Webhooks/Webhooks.API/Dockerfile
  54. +2
    -2
      src/Services/Webhooks/Webhooks.API/IntegrationEvents/OrderStatusChangedToPaidIntegrationEvent.cs
  55. +4
    -8
      src/Services/Webhooks/Webhooks.API/IntegrationEvents/OrderStatusChangedToShippedIntegrationEvent.cs
  56. +4
    -8
      src/Services/Webhooks/Webhooks.API/IntegrationEvents/ProductPriceChangedIntegrationEvent.cs
  57. +7
    -14
      src/Services/Webhooks/Webhooks.API/Program.cs
  58. +0
    -5
      src/Services/Webhooks/Webhooks.API/Startup.cs
  59. +11
    -11
      src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj
  60. +1
    -0
      src/Tests/Services/Application.FunctionalTests/Middleware/AutoAuthorizeMiddleware.cs
  61. +1
    -0
      src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingTestsStartup.cs
  62. +2
    -1
      src/Tests/Services/Application.FunctionalTests/Services/Ordering/appsettings.json
  63. +2
    -2
      src/Web/WebMVC/Dockerfile
  64. +59
    -61
      src/Web/WebMVC/Program.cs
  65. +13
    -13
      src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs
  66. +3
    -3
      src/Web/WebMVC/Services/ModelDTOs/LocationDTO.cs
  67. +2
    -2
      src/Web/WebMVC/Services/ModelDTOs/OrderDTO.cs
  68. +3
    -3
      src/Web/WebMVC/Services/ModelDTOs/OrderProcessAction.cs
  69. +0
    -3
      src/Web/WebMVC/Startup.cs
  70. +3
    -4
      src/Web/WebMVC/ViewModels/Basket.cs
  71. +9
    -14
      src/Web/WebMVC/ViewModels/BasketItem.cs
  72. +8
    -8
      src/Web/WebMVC/ViewModels/Campaign.cs
  73. +11
    -11
      src/Web/WebMVC/ViewModels/CampaignItem.cs
  74. +1
    -7
      src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs
  75. +6
    -9
      src/Web/WebMVC/ViewModels/Catalog.cs
  76. +11
    -14
      src/Web/WebMVC/ViewModels/CatalogItem.cs
  77. +0
    -3
      src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs
  78. +4
    -6
      src/Web/WebMVC/ViewModels/Header.cs
  79. +8
    -13
      src/Web/WebMVC/ViewModels/OrderItem.cs
  80. +1
    -6
      src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs
  81. +13
    -13
      src/Web/WebMVC/WebMVC.csproj
  82. +2
    -2
      src/Web/WebSPA/Dockerfile
  83. +25
    -33
      src/Web/WebSPA/Program.cs
  84. +8
    -8
      src/Web/WebSPA/WebSPA.csproj
  85. +2
    -2
      src/Web/WebStatus/Dockerfile
  86. +98
    -103
      src/Web/WebStatus/Program.cs
  87. +4
    -1
      src/Web/WebStatus/Startup.cs
  88. +13
    -12
      src/Web/WebStatus/WebStatus.csproj
  89. +2
    -2
      src/Web/WebhookClient/Dockerfile
  90. +7
    -21
      src/Web/WebhookClient/Program.cs
  91. +1
    -3
      src/Web/WebhookClient/Services/IWebhooksClient.cs
  92. +8
    -1
      src/Web/WebhookClient/Startup.cs
  93. +3
    -3
      src/Web/WebhookClient/WebhookClient.csproj

+ 0
- 76
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs View File

@ -1,76 +0,0 @@
using Grpc.Core;
using Grpc.Net.Client;
using Serilog;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public static class GrpcCallerService
{
public static async Task<TResponse> CallService<TResponse>(string urlGrpc, Func<GrpcChannel, Task<TResponse>> func)
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true);
var channel = GrpcChannel.ForAddress(urlGrpc);
/*
using var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; }
};
*/
Log.Information("Creating grpc client base address urlGrpc ={@urlGrpc}, BaseAddress={@BaseAddress} ", urlGrpc, channel.Target);
try
{
return await func(channel);
}
catch (RpcException e)
{
Log.Error("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
return default;
}
finally
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", false);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", false);
}
}
public static async Task CallService(string urlGrpc, Func<GrpcChannel, Task> func)
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true);
/*
using var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; }
};
*/
var channel = GrpcChannel.ForAddress(urlGrpc);
Log.Debug("Creating grpc client base address {@httpClient.BaseAddress} ", channel.Target);
try
{
await func(channel);
}
catch (RpcException e)
{
Log.Error("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
}
finally
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", false);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", false);
}
}
}
}

+ 0
- 78
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs View File

@ -1,78 +0,0 @@
using Grpc.Core;
using Grpc.Net.Client;
using Serilog;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public static class GrpcCallerService
{
public static async Task<TResponse> CallService<TResponse>(string urlGrpc, Func<GrpcChannel, Task<TResponse>> func)
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true);
var channel = GrpcChannel.ForAddress(urlGrpc);
/*
using var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; }
};
*/
Log.Information("Creating grpc client base address urlGrpc ={@urlGrpc}, BaseAddress={@BaseAddress} ", urlGrpc, channel.Target);
try
{
return await func(channel);
}
catch (RpcException e)
{
Log.Error("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
return default;
}
finally
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", false);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", false);
}
}
public static async Task CallService(string urlGrpc, Func<GrpcChannel, Task> func)
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true);
/*
using var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; }
};
*/
var channel = GrpcChannel.ForAddress(urlGrpc);
Log.Debug("Creating grpc client base address {@httpClient.BaseAddress} ", channel.Target);
try
{
await func(channel);
}
catch (RpcException e)
{
Log.Error("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
}
finally
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", false);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", false);
}
}
}
}

+ 3
- 3
src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
</ItemGroup>
</Project>

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

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


+ 3
- 3
src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs View File

@ -3,7 +3,7 @@ using Newtonsoft.Json;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
{
public class IntegrationEvent
public record IntegrationEvent
{
public IntegrationEvent()
{
@ -19,9 +19,9 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
}
[JsonProperty]
public Guid Id { get; private set; }
public Guid Id { get; private init; }
[JsonProperty]
public DateTime CreationDate { get; private set; }
public DateTime CreationDate { get; private init; }
}
}

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

@ -203,7 +203,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
private async Task Consumer_Received(object sender, BasicDeliverEventArgs eventArgs)
{
var eventName = eventArgs.RoutingKey;
var message = Encoding.UTF8.GetString(eventArgs.Body);
var message = Encoding.UTF8.GetString(eventArgs.Body.Span);
try
{


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

@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.4" />
<PackageReference Include="Autofac" Version="6.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Polly" Version="7.2.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.0.0-rc1" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="RabbitMQ.Client" Version="6.2.1" />
<PackageReference Include="System.ValueTuple" Version="4.6.0-preview1-26829-04" />
</ItemGroup>


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

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.4" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="4.1.1" />
<PackageReference Include="Autofac" Version="6.1.0" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
</ItemGroup>
<ItemGroup>


+ 5
- 5
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj View File

@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>


+ 9
- 8
src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj View File

@ -1,22 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="3.0.0-preview4-19123-01" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="3.1.0" />
<PackageReference Include="Polly" Version="7.2.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="5.0.0" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
</ItemGroup>
</Project>

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

@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.1" />


+ 2
- 2
src/Services/Basket/Basket.API/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs View File

@ -5,9 +5,9 @@ namespace Basket.API.IntegrationEvents.Events
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
public class OrderStartedIntegrationEvent : IntegrationEvent
public record OrderStartedIntegrationEvent : IntegrationEvent
{
public string UserId { get; set; }
public string UserId { get; init; }
public OrderStartedIntegrationEvent(string userId)
=> UserId = userId;


+ 4
- 4
src/Services/Basket/Basket.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs View File

@ -5,13 +5,13 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
public int ProductId { get; private set; }
public int ProductId { get; private init; }
public decimal NewPrice { get; private set; }
public decimal NewPrice { get; private init; }
public decimal OldPrice { get; private set; }
public decimal OldPrice { get; private init; }
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
{


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

@ -4,37 +4,37 @@ using System;
namespace Basket.API.IntegrationEvents.Events
{
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
{
public string UserId { get; }
public string UserName { get; }
public int OrderNumber { get; set; }
public int OrderNumber { get; init; }
public string City { get; set; }
public string City { get; init; }
public string Street { get; set; }
public string Street { get; init; }
public string State { get; set; }
public string State { get; init; }
public string Country { get; set; }
public string Country { get; init; }
public string ZipCode { get; set; }
public string ZipCode { get; init; }
public string CardNumber { get; set; }
public string CardNumber { get; init; }
public string CardHolderName { get; set; }
public string CardHolderName { get; init; }
public DateTime CardExpiration { get; set; }
public DateTime CardExpiration { get; init; }
public string CardSecurityNumber { get; set; }
public string CardSecurityNumber { get; init; }
public int CardTypeId { get; set; }
public int CardTypeId { get; init; }
public string Buyer { get; set; }
public string Buyer { get; init; }
public Guid RequestId { get; set; }
public Guid RequestId { get; init; }
public CustomerBasket Basket { get; }


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

@ -2,29 +2,29 @@
namespace Basket.API.Model
{
public record BasketCheckout
public class BasketCheckout
{
public string City { get; init; }
public string City { get; set; }
public string Street { get; init; }
public string Street { get; set; }
public string State { get; init; }
public string State { get; set; }
public string Country { get; init; }
public string Country { get; set; }
public string ZipCode { get; init; }
public string ZipCode { get; set; }
public string CardNumber { get; init; }
public string CardNumber { get; set; }
public string CardHolderName { get; init; }
public string CardHolderName { get; set; }
public DateTime CardExpiration { get; init; }
public DateTime CardExpiration { get; set; }
public string CardSecurityNumber { get; init; }
public string CardSecurityNumber { get; set; }
public int CardTypeId { get; init; }
public int CardTypeId { get; set; }
public string Buyer { get; init; }
public string Buyer { get; set; }
public Guid RequestId { get; set; }
}


+ 6
- 6
src/Services/Basket/Basket.API/Model/BasketItem.cs View File

@ -3,15 +3,15 @@ using System.ComponentModel.DataAnnotations;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
{
public record BasketItem : IValidatableObject
public class BasketItem : IValidatableObject
{
public string Id { get; init; }
public int ProductId { get; init; }
public string ProductName { get; init; }
public string Id { get; set; }
public int ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; init; }
public string PictureUrl { get; init; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var results = new List<ValidationResult>();


+ 2
- 2
src/Services/Basket/Basket.API/Model/CustomerBasket.cs View File

@ -2,9 +2,9 @@
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
{
public record CustomerBasket
public class CustomerBasket
{
public string BuyerId { get; init; }
public string BuyerId { get; set; }
public List<BasketItem> Items { get; set; } = new List<BasketItem>();


+ 2
- 2
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public IEnumerable<OrderStockItem> OrderStockItems { get; }
@ -16,7 +16,7 @@
}
}
public class OrderStockItem
public record OrderStockItem
{
public int ProductId { get; }
public int Units { get; }


+ 1
- 1
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using System.Collections.Generic;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public IEnumerable<OrderStockItem> OrderStockItems { get; }


+ 1
- 1
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using BuildingBlocks.EventBus.Events;
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 2
- 2
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public class OrderStockRejectedIntegrationEvent : IntegrationEvent
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
@ -17,7 +17,7 @@
}
}
public class ConfirmedOrderStockItem
public record ConfirmedOrderStockItem
{
public int ProductId { get; }
public bool HasStock { get; }


+ 4
- 4
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs View File

@ -5,13 +5,13 @@
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be past tense
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
public int ProductId { get; private set; }
public int ProductId { get; private init; }
public decimal NewPrice { get; private set; }
public decimal NewPrice { get; private init; }
public decimal OldPrice { get; private set; }
public decimal OldPrice { get; private init; }
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
{


+ 4
- 4
src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj View File

@ -33,10 +33,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>


+ 5
- 5
src/Services/Catalog/Catalog.UnitTests/Catalog.UnitTests.csproj View File

@ -7,11 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="3.1.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="5.0.0" />
<PackageReference Include="Moq" Version="4.15.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>


+ 17
- 16
src/Services/Identity/Identity.API/Identity.API.csproj View File

@ -16,39 +16,40 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.0.2" />
<PackageReference Include="IdentityServer4.EntityFramework.Storage" Version="3.0.2" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="3.0.2" />
<PackageReference Include="IdentityServer4.Storage" Version="3.0.2" />
<PackageReference Include="IdentityServer4" Version="3.0.2" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="2.2.0-preview3-35458" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
<PackageReference Include="Polly" Version="7.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.10" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.113" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
<PackageReference Include="Serilog.Sinks.Http" Version="5.2.0" />
<PackageReference Include="Serilog.Sinks.Http" Version="7.2.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.1.0-dev-00166" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
</ItemGroup>
<ItemGroup>


+ 0
- 1
src/Services/Identity/Identity.API/Startup.cs View File

@ -128,7 +128,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommand.cs View File

@ -11,7 +11,7 @@ namespace Ordering.API.Application.Commands
{
[DataMember]
public int OrderNumber { get; private set; }
public int OrderNumber { get; set; }
public CancelOrderCommand()
{


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderPaymentFailedIntegrationEvent .cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderPaymentSucceededIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs View File

@ -9,7 +9,7 @@ namespace Ordering.API.Application.IntegrationEvents.Events
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
public class OrderStartedIntegrationEvent : IntegrationEvent
public record OrderStartedIntegrationEvent : IntegrationEvent
{
public string UserId { get; set; }


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using System.Collections.Generic;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }
@ -20,7 +20,7 @@
}
}
public class OrderStockItem
public record OrderStockItem
{
public int ProductId { get; }
public int Units { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToCancelledIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public class OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using System.Collections.Generic;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToShippedIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStatusChangedTosubmittedIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public class OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs View File

@ -3,7 +3,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public class OrderStockRejectedIntegrationEvent : IntegrationEvent
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
@ -17,7 +17,7 @@
}
}
public class ConfirmedOrderStockItem
public record ConfirmedOrderStockItem
{
public int ProductId { get; }
public bool HasStock { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs View File

@ -4,7 +4,7 @@ using System;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
{
public string UserId { get; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Ordering.API.csproj View File

@ -52,7 +52,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.1" />


+ 1
- 1
src/Services/Ordering/Ordering.BackgroundTasks/Events/GracePeriodConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Ordering.SignalrHub.IntegrationEvents
{
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToCancelledIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.Events
{
public class OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.Events
{
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToShippedIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.Events
{
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
namespace Ordering.SignalrHub.IntegrationEvents.Events
{
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToSubmittedIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.Events
{
public class OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public string OrderStatus { get; }


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj View File

@ -20,7 +20,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="3.0.0-preview4-19123-01" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />


+ 1
- 1
src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderPaymentFailedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderPaymentSucceededIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 1
src/Services/Payment/Payment.API/IntegrationEvents/Events/OrderStatusChangedToStockConfirmedIntegrationEvent.cs View File

@ -2,7 +2,7 @@
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 2
- 2
src/Services/Webhooks/Webhooks.API/Dockerfile View File

@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles


+ 2
- 2
src/Services/Webhooks/Webhooks.API/IntegrationEvents/OrderStatusChangedToPaidIntegrationEvent.cs View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Webhooks.API.IntegrationEvents
{
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }
public IEnumerable<OrderStockItem> OrderStockItems { get; }
@ -19,7 +19,7 @@ namespace Webhooks.API.IntegrationEvents
}
}
public class OrderStockItem
public record OrderStockItem
{
public int ProductId { get; }
public int Units { get; }


+ 4
- 8
src/Services/Webhooks/Webhooks.API/IntegrationEvents/OrderStatusChangedToShippedIntegrationEvent.cs View File

@ -1,16 +1,12 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Webhooks.API.IntegrationEvents
{
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; private set; }
public string OrderStatus { get; private set; }
public string BuyerName { get; private set; }
public int OrderId { get; private init; }
public string OrderStatus { get; private init; }
public string BuyerName { get; private init; }
public OrderStatusChangedToShippedIntegrationEvent(int orderId, string orderStatus, string buyerName)
{


+ 4
- 8
src/Services/Webhooks/Webhooks.API/IntegrationEvents/ProductPriceChangedIntegrationEvent.cs View File

@ -1,18 +1,14 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Webhooks.API.IntegrationEvents
{
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
public int ProductId { get; private set; }
public int ProductId { get; private init; }
public decimal NewPrice { get; private set; }
public decimal NewPrice { get; private init; }
public decimal OldPrice { get; private set; }
public decimal OldPrice { get; private init; }
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
{


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

@ -7,20 +7,15 @@ using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Webhooks.API;
using Webhooks.API.Infrastructure;
namespace Webhooks.API
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build()
.MigrateDbContext<WebhooksContext>((_,__) => { })
.Run();
}
CreateWebHostBuilder(args).Build()
.MigrateDbContext<WebhooksContext>((_, __) => { })
.Run();
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
@ -33,6 +28,4 @@ namespace Webhooks.API
builder.AddConsole();
builder.AddDebug();
builder.AddAzureWebAppDiagnostics();
});
}
}
});

+ 0
- 5
src/Services/Webhooks/Webhooks.API/Startup.cs View File

@ -174,11 +174,6 @@ namespace Webhooks.API
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
sqlOptions.EnableRetryOnFailure(maxRetryCount: 15, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
});
// Changing default behavior when client evaluation occurs to throw.
// Default in EF Core would be to log a warning when client evaluation is performed.
options.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning));
//Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval
});
return services;


+ 11
- 11
src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -11,18 +11,18 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="3.0.0-alpha1-10670" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc5" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
<ItemGroup>


+ 1
- 0
src/Tests/Services/Application.FunctionalTests/Middleware/AutoAuthorizeMiddleware.cs View File

@ -25,6 +25,7 @@ namespace FunctionalTests.Middleware
identity.AddClaim(new Claim("sub", IDENTITY_ID));
identity.AddClaim(new Claim("unique_name", IDENTITY_ID));
identity.AddClaim(new Claim(ClaimTypes.Name, IDENTITY_ID));
httpContext.User.AddIdentity(identity);
await _next.Invoke(httpContext);


+ 1
- 0
src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingTestsStartup.cs View File

@ -20,6 +20,7 @@ namespace FunctionalTests.Services.Ordering
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
{
app.UseMiddleware<AutoAuthorizeMiddleware>();
app.UseAuthorization();
}
else
{


+ 2
- 1
src/Tests/Services/Application.FunctionalTests/Services/Ordering/appsettings.json View File

@ -6,5 +6,6 @@
"EventBusConnection": "localhost",
"CheckUpdateTime": "30000",
"GracePeriodTime": "1",
"SubscriptionClientName": "Ordering"
"SubscriptionClientName": "Ordering",
"IdentityUrlExternal": "http://localhost:5105"
}

+ 2
- 2
src/Web/WebMVC/Dockerfile View File

@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles


+ 59
- 61
src/Web/WebMVC/Program.cs View File

@ -1,79 +1,77 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.WebMVC;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
using System;
using System.IO;
namespace Microsoft.eShopOnContainers.WebMVC
{
public class Program
{
public static readonly string Namespace = typeof(Program).Namespace;
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
var configuration = GetConfiguration();
public static int Main(string[] args)
{
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);
Log.Logger = CreateSerilogLogger(configuration);
try
{
Log.Information("Configuring web host ({ApplicationContext})...", Program.AppName);
var host = BuildWebHost(configuration, args);
try
{
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
var host = BuildWebHost(configuration, args);
Log.Information("Starting web host ({ApplicationContext})...", Program.AppName);
host.Run();
Log.Information("Starting web host ({ApplicationContext})...", AppName);
host.Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", Program.AppName);
return 1;
}
finally
{
Log.CloseAndFlush();
}
IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(false)
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
.UseStartup<Startup>()
.UseSerilog()
.Build();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
{
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
var logstashUrl = configuration["Serilog:LogstashgUrl"];
var cfg = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.Enrich.WithProperty("ApplicationContext", Program.AppName)
.Enrich.FromLogContext()
.WriteTo.Console();
if (!string.IsNullOrWhiteSpace(seqServerUrl))
{
cfg.WriteTo.Seq(seqServerUrl);
}
if (!string.IsNullOrWhiteSpace(logstashUrl))
{
cfg.WriteTo.Http(logstashUrl);
}
return cfg.CreateLogger();
}
private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(false)
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
.UseStartup<Startup>()
.UseSerilog()
.Build();
IConfiguration GetConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
{
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
var logstashUrl = configuration["Serilog:LogstashgUrl"];
var cfg = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.Enrich.WithProperty("ApplicationContext", AppName)
.Enrich.FromLogContext()
.WriteTo.Console();
if (!string.IsNullOrWhiteSpace(seqServerUrl)) {
cfg.WriteTo.Seq(seqServerUrl);
}
if (!string.IsNullOrWhiteSpace(logstashUrl)) {
cfg.WriteTo.Http(logstashUrl);
}
return cfg.CreateLogger();
}
return builder.Build();
}
private static IConfiguration GetConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
return builder.Build();
}
}
public class Program
{
private static readonly string _namespace = typeof(Startup).Namespace;
public static readonly string AppName = _namespace.Substring(_namespace.LastIndexOf('.', _namespace.LastIndexOf('.') - 1) + 1);
}

+ 13
- 13
src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs View File

@ -3,35 +3,35 @@ using System.ComponentModel.DataAnnotations;
namespace WebMVC.Services.ModelDTOs
{
public class BasketDTO
public record BasketDTO
{
[Required]
public string City { get; set; }
public string City { get; init; }
[Required]
public string Street { get; set; }
public string Street { get; init; }
[Required]
public string State { get; set; }
public string State { get; init; }
[Required]
public string Country { get; set; }
public string Country { get; init; }
public string ZipCode { get; set; }
public string ZipCode { get; init; }
[Required]
public string CardNumber { get; set; }
public string CardNumber { get; init; }
[Required]
public string CardHolderName { get; set; }
public string CardHolderName { get; init; }
[Required]
public DateTime CardExpiration { get; set; }
public DateTime CardExpiration { get; init; }
[Required]
public string CardSecurityNumber { get; set; }
public string CardSecurityNumber { get; init; }
public int CardTypeId { get; set; }
public int CardTypeId { get; init; }
public string Buyer { get; set; }
public string Buyer { get; init; }
[Required]
public Guid RequestId { get; set; }
public Guid RequestId { get; init; }
}
}

+ 3
- 3
src/Web/WebMVC/Services/ModelDTOs/LocationDTO.cs View File

@ -1,8 +1,8 @@
namespace WebMVC.Services.ModelDTOs
{
public class LocationDTO
public record LocationDTO
{
public double Longitude { get; set; }
public double Latitude { get; set; }
public double Longitude { get; init; }
public double Latitude { get; init; }
}
}

+ 2
- 2
src/Web/WebMVC/Services/ModelDTOs/OrderDTO.cs View File

@ -2,9 +2,9 @@
namespace WebMVC.Services.ModelDTOs
{
public class OrderDTO
public record OrderDTO
{
[Required]
public string OrderNumber { get; set; }
public string OrderNumber { get; init; }
}
}

+ 3
- 3
src/Web/WebMVC/Services/ModelDTOs/OrderProcessAction.cs View File

@ -1,9 +1,9 @@
namespace WebMVC.Services.ModelDTOs
{
public class OrderProcessAction
public record OrderProcessAction
{
public string Code { get; private set; }
public string Name { get; private set; }
public string Code { get; }
public string Name { get; }
public static OrderProcessAction Ship = new OrderProcessAction(nameof(Ship).ToLowerInvariant(), "Ship");


+ 0
- 3
src/Web/WebMVC/Startup.cs View File

@ -7,19 +7,16 @@ using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using StackExchange.Redis;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using WebMVC.Infrastructure;
using WebMVC.Infrastructure.Middlewares;
using WebMVC.Services;


+ 3
- 4
src/Web/WebMVC/ViewModels/Basket.cs View File

@ -1,18 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Basket
public record Basket
{
// Use property initializer syntax.
// While this is often more useful for read only
// auto implemented properties, it can simplify logic
// for read/write properties.
public List<BasketItem> Items { get; set; } = new List<BasketItem>();
public string BuyerId { get; set; }
public List<BasketItem> Items { get; init; } = new List<BasketItem>();
public string BuyerId { get; init; }
public decimal Total()
{


+ 9
- 14
src/Web/WebMVC/ViewModels/BasketItem.cs View File

@ -1,18 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class BasketItem
public record BasketItem
{
public string Id { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
public string Id { get; init; }
public string ProductId { get; init; }
public string ProductName { get; init; }
public decimal UnitPrice { get; init; }
public decimal OldUnitPrice { get; init; }
public int Quantity { get; init; }
public string PictureUrl { get; init; }
}
}

+ 8
- 8
src/Web/WebMVC/ViewModels/Campaign.cs View File

@ -1,12 +1,12 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
using System.Collections.Generic;
using System.Collections.Generic;
public class Campaign
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record Campaign
{
public int PageIndex { get; set; }
public int PageSize { get; set; }
public int Count { get; set; }
public List<CampaignItem> Data { get; set; }
public int PageIndex { get; init; }
public int PageSize { get; init; }
public int Count { get; init; }
public List<CampaignItem> Data { get; init; }
}
}

+ 11
- 11
src/Web/WebMVC/ViewModels/CampaignItem.cs View File

@ -1,20 +1,20 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
using System;
using System;
public class CampaignItem
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record CampaignItem
{
public int Id { get; set; }
public int Id { get; init; }
public string Name { get; set; }
public string Name { get; init; }
public string Description { get; set; }
public string Description { get; init; }
public DateTime From { get; set; }
public DateTime From { get; init; }
public DateTime To { get; set; }
public DateTime To { get; init; }
public string PictureUri { get; set; }
public string DetailsUri { get; set; }
public string PictureUri { get; init; }
public string DetailsUri { get; init; }
}
}

+ 1
- 7
src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs View File

@ -1,10 +1,4 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels
{
public class CartComponentViewModel
{


+ 6
- 9
src/Web/WebMVC/ViewModels/Catalog.cs View File

@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Catalog
public record Catalog
{
public int PageIndex { get; set; }
public int PageSize { get; set; }
public int Count { get; set; }
public List<CatalogItem> Data { get; set; }
public int PageIndex { get; init; }
public int PageSize { get; init; }
public int Count { get; init; }
public List<CatalogItem> Data { get; init; }
}
}

+ 11
- 14
src/Web/WebMVC/ViewModels/CatalogItem.cs View File

@ -1,18 +1,15 @@
using System;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class CatalogItem
public record CatalogItem
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public string PictureUri { get; set; }
public int CatalogBrandId { get; set; }
public string CatalogBrand { get; set; }
public int CatalogTypeId { get; set; }
public string CatalogType { get; set; }
public int Id { get; init; }
public string Name { get; init; }
public string Description { get; init; }
public decimal Price { get; init; }
public string PictureUri { get; init; }
public int CatalogBrandId { get; init; }
public string CatalogBrand { get; init; }
public int CatalogTypeId { get; init; }
public string CatalogType { get; init; }
}
}

+ 0
- 3
src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs View File

@ -1,9 +1,6 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
{


+ 4
- 6
src/Web/WebMVC/ViewModels/Header.cs View File

@ -1,10 +1,8 @@
using System;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Header
public record Header
{
public string Controller { get; set; }
public string Text { get; set; }
public string Controller { get; init; }
public string Text { get; init; }
}
}

+ 8
- 13
src/Web/WebMVC/ViewModels/OrderItem.cs View File

@ -1,22 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class OrderItem
public record OrderItem
{
public int ProductId { get; set; }
public int ProductId { get; init; }
public string ProductName { get; set; }
public string ProductName { get; init; }
public decimal UnitPrice { get; set; }
public decimal UnitPrice { get; init; }
public decimal Discount { get; set; }
public decimal Discount { get; init; }
public int Units { get; set; }
public int Units { get; init; }
public string PictureUrl { get; set; }
public string PictureUrl { get; init; }
}
}

+ 1
- 6
src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination
{
public class PaginationInfo
{


+ 13
- 13
src/Web/WebMVC/WebMVC.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>aspnet-Microsoft.eShopOnContainers-946ae052-8305-4a99-965b-ec8636ddbae3</UserSecretsId>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
<TypeScriptToolsVersion>3.0</TypeScriptToolsVersion>
@ -23,25 +23,25 @@
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.3" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.0.0" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.435" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.1.2" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="2.2.0-preview3-35458" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.4.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.8.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.113" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
<PackageReference Include="Serilog.Sinks.Http" Version="5.2.0" />
<PackageReference Include="Serilog.Sinks.Http" Version="7.2.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.1.0-dev-00166" />
</ItemGroup>


+ 2
- 2
src/Web/WebSPA/Dockerfile View File

@ -1,5 +1,5 @@
ARG NODE_IMAGE=node:12.0
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
@ -10,7 +10,7 @@ COPY Web/WebSPA/package-lock.json .
COPY Web/WebSPA .
RUN npm i npm@latest -g && npm update && npm install && npm run build:prod
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles


+ 25
- 33
src/Web/WebSPA/Program.cs View File

@ -4,38 +4,30 @@ using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Serilog;
using eShopConContainers.WebSPA;
namespace eShopConContainers.WebSPA
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
BuildWebHost(args).Run();
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
builder.AddAzureWebAppDiagnostics();
})
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
})
.Build();
}
}
IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
builder.AddAzureWebAppDiagnostics();
})
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
})
.Build();

+ 8
- 8
src/Web/WebSPA/WebSPA.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119</UserSecretsId>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
<TypeScriptCompileOnSaveEnabled>false</TypeScriptCompileOnSaveEnabled>
@ -87,16 +87,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.1.2" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="2.2.0-preview3-35458" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
</ItemGroup>


+ 2
- 2
src/Web/WebStatus/Dockerfile View File

@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles


+ 98
- 103
src/Web/WebStatus/Program.cs View File

@ -7,119 +7,114 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using WebStatus;
namespace WebStatus
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);
try
{
public class Program
{
public static readonly string Namespace = typeof(Program).Namespace;
public static readonly string AppName = Namespace;
Log.Information("Configuring web host ({ApplicationContext})...", Program.AppName);
var host = BuildWebHost(configuration, args);
public static int Main(string[] args)
{
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);
try
{
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
var host = BuildWebHost(configuration, args);
LogPackagesVersionInfo();
Log.Information("Starting web host ({ApplicationContext})...", AppName);
host.Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
LogPackagesVersionInfo();
private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(false)
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseSerilog()
.Build();
Log.Information("Starting web host ({ApplicationContext})...", Program.AppName);
host.Run();
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
{
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
var logstashUrl = configuration["Serilog:LogstashgUrl"];
return new LoggerConfiguration()
.MinimumLevel.Verbose()
.Enrich.WithProperty("ApplicationContext", AppName)
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl)
.ReadFrom.Configuration(configuration)
.CreateLogger();
}
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", Program.AppName);
return 1;
}
finally
{
Log.CloseAndFlush();
}
IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(false)
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseSerilog()
.Build();
Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
{
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
var logstashUrl = configuration["Serilog:LogstashgUrl"];
return new LoggerConfiguration()
.MinimumLevel.Verbose()
.Enrich.WithProperty("ApplicationContext", Program.AppName)
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl)
.ReadFrom.Configuration(configuration)
.CreateLogger();
}
IConfiguration GetConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
private static IConfiguration GetConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
var config = builder.Build();
if (config.GetValue<bool>("UseVault", false))
{
builder.AddAzureKeyVault(
$"https://{config["Vault:Name"]}.vault.azure.net/",
config["Vault:ClientId"],
config["Vault:ClientSecret"]);
}
return builder.Build();
}
var config = builder.Build();
if (config.GetValue<bool>("UseVault", false))
{
builder.AddAzureKeyVault(
$"https://{config["Vault:Name"]}.vault.azure.net/",
config["Vault:ClientId"],
config["Vault:ClientSecret"]);
}
private static string GetVersion(Assembly assembly)
return builder.Build();
}
string GetVersion(Assembly assembly)
{
try
{
return $"{assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version} ({assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split()[0]})";
}
catch
{
return string.Empty;
}
}
void LogPackagesVersionInfo()
{
var assemblies = new List<Assembly>();
foreach (var dependencyName in typeof(Program).Assembly.GetReferencedAssemblies())
{
try
{
try
{
return $"{assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version} ({assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split()[0]})";
}
catch
{
return string.Empty;
}
// Try to load the referenced assembly...
assemblies.Add(Assembly.Load(dependencyName));
}
private static void LogPackagesVersionInfo()
catch
{
var assemblies = new List<Assembly>();
foreach (var dependencyName in typeof(Program).Assembly.GetReferencedAssemblies())
{
try
{
// Try to load the referenced assembly...
assemblies.Add(Assembly.Load(dependencyName));
}
catch
{
// Failed to load assembly. Skip it.
}
}
var versionList = assemblies.Select(a => $"-{a.GetName().Name} - {GetVersion(a)}").OrderBy(value => value);
Log.Logger.ForContext("PackageVersions", string.Join("\n", versionList)).Information("Package versions ({ApplicationContext})", AppName);
// Failed to load assembly. Skip it.
}
}
var versionList = assemblies.Select(a => $"-{a.GetName().Name} - {GetVersion(a)}").OrderBy(value => value);
Log.Logger.ForContext("PackageVersions", string.Join("\n", versionList)).Information("Package versions ({ApplicationContext})", Program.AppName);
}
public class Program
{
private static readonly string _namespace = typeof(Startup).Namespace;
public static readonly string AppName = _namespace;
}

+ 4
- 1
src/Web/WebStatus/Startup.cs View File

@ -30,7 +30,10 @@ namespace WebStatus
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy());
services.AddHealthChecksUI();
services
.AddHealthChecksUI()
.AddInMemoryStorage();
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
}


+ 13
- 12
src/Web/WebStatus/WebStatus.csproj View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
@ -8,21 +8,22 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="3.0.6" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="3.1.3" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="3.1.2" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.1.2" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.10" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.113" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
<PackageReference Include="Serilog.Sinks.Http" Version="5.2.0" />
<PackageReference Include="Serilog.Sinks.Http" Version="7.2.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.1.0-dev-00166" />
</ItemGroup>


+ 2
- 2
src/Web/WebhookClient/Dockerfile View File

@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles


+ 7
- 21
src/Web/WebhookClient/Program.cs View File

@ -1,24 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using WebhookClient;
namespace WebhookClient
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
CreateWebHostBuilder(args).Build().Run();
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();

+ 1
- 3
src/Web/WebhookClient/Services/IWebhooksClient.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using WebhookClient.Models;


+ 8
- 1
src/Web/WebhookClient/Startup.cs View File

@ -61,7 +61,6 @@ namespace WebhookClient
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
}
app.UseAuthentication();
app.Map("/check", capp =>
{
capp.Run(async (context) =>
@ -92,12 +91,20 @@ namespace WebhookClient
}
});
});
// Fix samesite issue when running eShop from docker-compose locally as by default http protocol is being used
// Refer to https://github.com/dotnet-architecture/eShopOnContainers/issues/1391
app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.Lax });
app.UseStaticFiles();
app.UseSession();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
endpoints.MapRazorPages();
});
}
}


+ 3
- 3
src/Web/WebhookClient/WebhookClient.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UserSecretsId>36215d41-f31a-4aa6-9929-bd67d650e7b5</UserSecretsId>
@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.1" />
</ItemGroup>
</Project>

Loading…
Cancel
Save