Merge pull request #1559 from borjasanes/feature/webapps-net5-migration
Feature/webapps net5 migration
This commit is contained in:
commit
3434459888
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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,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,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; }
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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" />
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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,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>();
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -128,7 +128,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseDatabaseErrorPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
public int OrderNumber { get; set; }
|
||||
public CancelOrderCommand()
|
||||
{
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -4,7 +4,7 @@ using System;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; }
|
||||
|
||||
|
@ -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" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -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
|
||||
|
@ -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; }
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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,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();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -20,6 +20,7 @@ namespace FunctionalTests.Services.Ordering
|
||||
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
|
||||
{
|
||||
app.UseMiddleware<AutoAuthorizeMiddleware>();
|
||||
app.UseAuthorization();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6,5 +6,6 @@
|
||||
"EventBusConnection": "localhost",
|
||||
"CheckUpdateTime": "30000",
|
||||
"GracePeriodTime": "1",
|
||||
"SubscriptionClientName": "Ordering"
|
||||
"SubscriptionClientName": "Ordering",
|
||||
"IdentityUrlExternal": "http://localhost:5105"
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
var configuration = GetConfiguration();
|
||||
|
||||
Log.Logger = CreateSerilogLogger(configuration);
|
||||
|
||||
try
|
||||
{
|
||||
public class Program
|
||||
Log.Information("Configuring web host ({ApplicationContext})...", Program.AppName);
|
||||
var host = BuildWebHost(configuration, args);
|
||||
|
||||
Log.Information("Starting web host ({ApplicationContext})...", Program.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();
|
||||
|
||||
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))
|
||||
{
|
||||
public static readonly string Namespace = typeof(Program).Namespace;
|
||||
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
||||
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.CaptureStartupErrors(false)
|
||||
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
||||
.UseStartup<Startup>()
|
||||
.UseSerilog()
|
||||
.Build();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private static IConfiguration GetConfiguration()
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
cfg.WriteTo.Seq(seqServerUrl);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(logstashUrl))
|
||||
{
|
||||
cfg.WriteTo.Http(logstashUrl);
|
||||
}
|
||||
return cfg.CreateLogger();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,9 +2,9 @@
|
||||
|
||||
namespace WebMVC.Services.ModelDTOs
|
||||
{
|
||||
public class OrderDTO
|
||||
public record OrderDTO
|
||||
{
|
||||
[Required]
|
||||
public string OrderNumber { get; set; }
|
||||
public string OrderNumber { get; init; }
|
||||
}
|
||||
}
|
@ -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");
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
||||
using System;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
||||
{
|
||||
using System;
|
||||
|
||||
public class CampaignItem
|
||||
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,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
|
||||
{
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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,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
|
||||
{
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
IWebHost BuildWebHost(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.ConfigureAppConfiguration((builderContext, config) =>
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
Log.Information("Configuring web host ({ApplicationContext})...", Program.AppName);
|
||||
var host = BuildWebHost(configuration, args);
|
||||
|
||||
LogPackagesVersionInfo();
|
||||
|
||||
Log.Information("Starting web host ({ApplicationContext})...", Program.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>()
|
||||
.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();
|
||||
|
||||
var config = builder.Build();
|
||||
|
||||
if (config.GetValue<bool>("UseVault", false))
|
||||
{
|
||||
public static readonly string Namespace = typeof(Program).Namespace;
|
||||
public static readonly string AppName = Namespace;
|
||||
builder.AddAzureKeyVault(
|
||||
$"https://{config["Vault:Name"]}.vault.azure.net/",
|
||||
config["Vault:ClientId"],
|
||||
config["Vault:ClientSecret"]);
|
||||
}
|
||||
|
||||
public static int Main(string[] args)
|
||||
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
|
||||
{
|
||||
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();
|
||||
}
|
||||
// Try to load the referenced assembly...
|
||||
assemblies.Add(Assembly.Load(dependencyName));
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
||||
catch
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private static string GetVersion(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $"{assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version} ({assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split()[0]})";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static void LogPackagesVersionInfo()
|
||||
{
|
||||
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;
|
||||
}
|
@ -30,7 +30,10 @@ namespace WebStatus
|
||||
services.AddHealthChecks()
|
||||
.AddCheck("self", () => HealthCheckResult.Healthy());
|
||||
|
||||
services.AddHealthChecksUI();
|
||||
services
|
||||
.AddHealthChecksUI()
|
||||
.AddInMemoryStorage();
|
||||
|
||||
services.AddMvc()
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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…
x
Reference in New Issue
Block a user