@ -0,0 +1,29 @@ | |||
#https://github.com/spring2/dockerfiles/tree/master/rabbitmq | |||
FROM microsoft/windowsservercore | |||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | |||
ENV chocolateyUseWindowsCompression false | |||
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \ | |||
choco install -y curl; | |||
RUN choco install -y erlang | |||
ENV ERLANG_SERVICE_MANAGER_PATH="C:\Program Files\erl8.2\erts-8.2\bin" | |||
RUN choco install -y rabbitmq | |||
ENV RABBITMQ_SERVER="C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5" | |||
ENV RABBITMQ_CONFIG_FILE="c:\rabbitmq" | |||
COPY rabbitmq.config C:/ | |||
COPY rabbitmq.config C:/Users/ContainerAdministrator/AppData/Roaming/RabbitMQ/ | |||
COPY enabled_plugins C:/Users/ContainerAdministrator/AppData/Roaming/RabbitMQ/ | |||
EXPOSE 4369 | |||
EXPOSE 5672 | |||
EXPOSE 5671 | |||
EXPOSE 15672 | |||
WORKDIR C:/Program\ Files/RabbitMQ\ Server/rabbitmq_server-3.6.5/sbin | |||
CMD .\rabbitmq-server.bat |
@ -0,0 +1 @@ | |||
[rabbitmq_amqp1_0,rabbitmq_management]. |
@ -0,0 +1 @@ | |||
[{rabbit, [{loopback_users, []}]}]. |
@ -0,0 +1,30 @@ | |||
# The MSI installs a service which is hard to override, so let's use a zip file. | |||
FROM microsoft/windowsservercore | |||
MAINTAINER alexellis2@gmail.com | |||
SHELL ["powershell"] | |||
RUN $ErrorActionPreference = 'Stop'; \ | |||
wget https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile Redis-x64-3.2.100.zip ; \ | |||
Expand-Archive Redis-x64-3.2.100.zip -dest 'C:\\Program Files\\Redis\\' ; \ | |||
Remove-Item Redis-x64-3.2.100.zip -Force | |||
RUN setx PATH '%PATH%;C:\\Program Files\\Redis\\' | |||
WORKDIR 'C:\\Program Files\\Redis\\' | |||
RUN Get-Content redis.windows.conf | Where { $_ -notmatch 'bind 127.0.0.1' } | Set-Content redis.openport.conf ; \ | |||
Get-Content redis.openport.conf | Where { $_ -notmatch 'protected-mode yes' } | Set-Content redis.unprotected.conf ; \ | |||
Add-Content redis.unprotected.conf 'protected-mode no' ; \ | |||
Add-Content redis.unprotected.conf 'bind 0.0.0.0' ; \ | |||
Get-Content redis.unprotected.conf | |||
EXPOSE 6379 | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
# Define our command to be run when launching the container | |||
CMD .\\redis-server.exe .\\redis.unprotected.conf --port 6379 ; \ | |||
Write-Host Redis Started... ; \ | |||
while ($true) { Start-Sleep -Seconds 3600 } |
@ -0,0 +1,79 @@ | |||
version: '2.1' | |||
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine. | |||
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: | |||
# ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost | |||
# but values present in the environment vars at runtime will always override those defined inside the .env file | |||
# An external IP or DNS name has to be used (instead localhost and the 10.0.75.1 IP) when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance. | |||
services: | |||
basket.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5103 | |||
- ConnectionString=basket.data | |||
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. | |||
- EventBusConnection=rabbitmq | |||
ports: | |||
- "5103:5103" | |||
catalog.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5101 | |||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word | |||
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. | |||
- EventBusConnection=rabbitmq | |||
ports: | |||
- "5101:5101" | |||
identity.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5105 | |||
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104 | |||
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word | |||
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105. | |||
ports: | |||
- "5105:5105" | |||
ordering.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5102 | |||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word | |||
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. | |||
- EventBusConnection=rabbitmq | |||
ports: | |||
- "5102:5102" | |||
webspa: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5104 | |||
- CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 | |||
- OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 | |||
- IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. | |||
- BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 | |||
ports: | |||
- "5104:5104" | |||
webmvc: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Development | |||
- ASPNETCORE_URLS=http://0.0.0.0:5100 | |||
- CatalogUrl=http://catalog.api:5101 | |||
- OrderingUrl=http://ordering.api:5102 | |||
- BasketUrl=http://basket.api:5103 | |||
- IdentityUrl=http://10.0.75.1:5105 #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. | |||
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. | |||
ports: | |||
- "5100:5100" | |||
sql.data: | |||
environment: | |||
- SA_PASSWORD=Pass@word | |||
- ACCEPT_EULA=Y | |||
ports: | |||
- "5433:1433" |
@ -0,0 +1,80 @@ | |||
version: '2.1' | |||
# The Production docker-compose file has to have the external/real IPs or DNS names for the services | |||
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: | |||
# ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=192.168.88.248 | |||
# but values present in the environment vars at runtime will always override those defined inside the .env file | |||
# An external IP or DNS name has to be used when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance. | |||
# | |||
# Set ASPNETCORE_ENVIRONMENT=Development to get errors while testing. | |||
# | |||
# You need to start it with the following CLI command: | |||
# docker-compose -f docker-compose-windows.yml -f docker-compose-windows.prod.yml up -d | |||
services: | |||
basket.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5103 | |||
- ConnectionString=basket.data | |||
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. | |||
ports: | |||
- "5103:5103" | |||
catalog.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5101 | |||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word | |||
- ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. | |||
ports: | |||
- "5101:5101" | |||
identity.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5105 | |||
- SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104 | |||
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word | |||
- MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105. | |||
ports: | |||
- "5105:5105" | |||
ordering.api: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5102 | |||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word | |||
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. | |||
ports: | |||
- "5102:5102" | |||
webspa: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5104 | |||
- CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 | |||
- OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 | |||
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. | |||
- BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 | |||
ports: | |||
- "5104:5104" | |||
webmvc: | |||
environment: | |||
- ASPNETCORE_ENVIRONMENT=Production | |||
- ASPNETCORE_URLS=http://0.0.0.0:5100 | |||
- CatalogUrl=http://catalog.api:5101 | |||
- OrderingUrl=http://ordering.api:5102 | |||
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. | |||
- BasketUrl=http://basket.api:5103 | |||
ports: | |||
- "5100:5100" | |||
sql.data: | |||
environment: | |||
- SA_PASSWORD=Pass@word | |||
- ACCEPT_EULA=Y | |||
ports: | |||
- "5433:1433" |
@ -0,0 +1,80 @@ | |||
version: '2.1' | |||
services: | |||
basket.api: | |||
image: eshop/basket.api | |||
build: | |||
context: ./src/Services/Basket/Basket.API | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- basket.data | |||
- identity.api | |||
catalog.api: | |||
image: eshop/catalog.api | |||
build: | |||
context: ./src/Services/Catalog/Catalog.API | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- sql.data | |||
identity.api: | |||
image: eshop/identity.api | |||
build: | |||
context: ./src/Services/Identity/Identity.API | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- sql.data | |||
ordering.api: | |||
image: eshop/ordering.api | |||
build: | |||
context: ./src/Services/Ordering/Ordering.API | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- sql.data | |||
webspa: | |||
image: eshop/webspa | |||
build: | |||
context: ./src/Web/WebSPA | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- identity.api | |||
- basket.api | |||
webmvc: | |||
image: eshop/webmvc | |||
build: | |||
context: ./src/Web/WebMVC | |||
dockerfile: Dockerfile.nanowin | |||
depends_on: | |||
- catalog.api | |||
- ordering.api | |||
- identity.api | |||
- basket.api | |||
sql.data: | |||
image: microsoft/mssql-server-windows | |||
basket.data: | |||
image: redis | |||
build: | |||
context: ./_docker/redis | |||
dockerfile: Dockerfile.nanowin | |||
ports: | |||
- "6379:6379" | |||
rabbitmq: | |||
image: rabbitmq | |||
build: | |||
context: ./_docker/rabbitmq | |||
dockerfile: Dockerfile.nanowin | |||
ports: | |||
- "5672:5672" | |||
networks: | |||
default: | |||
external: | |||
name: nat | |||
@ -0,0 +1,48 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF | |||
{ | |||
public class IntegrationEventLogContext : DbContext | |||
{ | |||
public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> options) : base(options) | |||
{ | |||
} | |||
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; } | |||
protected override void OnModelCreating(ModelBuilder builder) | |||
{ | |||
builder.Entity<IntegrationEventLogEntry>(ConfigureIntegrationEventLogEntry); | |||
} | |||
void ConfigureIntegrationEventLogEntry(EntityTypeBuilder<IntegrationEventLogEntry> builder) | |||
{ | |||
builder.ToTable("IntegrationEventLog"); | |||
builder.HasKey(e => e.EventId); | |||
builder.Property(e => e.EventId) | |||
.IsRequired(); | |||
builder.Property(e => e.Content) | |||
.IsRequired(); | |||
builder.Property(e => e.CreationTime) | |||
.IsRequired(); | |||
builder.Property(e => e.State) | |||
.IsRequired(); | |||
builder.Property(e => e.TimesSent) | |||
.IsRequired(); | |||
builder.Property(e => e.EventTypeName) | |||
.IsRequired(); | |||
} | |||
} | |||
} |
@ -0,0 +1,27 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netcoreapp1.1</TargetFramework> | |||
<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion> | |||
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF</RootNamespace> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.1" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.1" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\EventBus\EventBus.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@ -0,0 +1,15 @@ | |||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data.Common; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services | |||
{ | |||
public interface IIntegrationEventLogService | |||
{ | |||
Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction); | |||
Task MarkEventAsPublishedAsync(IntegrationEvent @event); | |||
} | |||
} |
@ -0,0 +1,53 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Storage; | |||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; | |||
using System.Data.Common; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System; | |||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services | |||
{ | |||
public class IntegrationEventLogService : IIntegrationEventLogService | |||
{ | |||
private readonly IntegrationEventLogContext _integrationEventLogContext; | |||
private readonly DbConnection _dbConnection; | |||
public IntegrationEventLogService(DbConnection dbConnection) | |||
{ | |||
_dbConnection = dbConnection?? throw new ArgumentNullException("dbConnection"); | |||
_integrationEventLogContext = new IntegrationEventLogContext( | |||
new DbContextOptionsBuilder<IntegrationEventLogContext>() | |||
.UseSqlServer(_dbConnection) | |||
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) | |||
.Options); | |||
} | |||
public Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction) | |||
{ | |||
if(transaction == null) | |||
{ | |||
throw new ArgumentNullException("transaction", $"A {typeof(DbTransaction).FullName} is required as a pre-requisite to save the event."); | |||
} | |||
var eventLogEntry = new IntegrationEventLogEntry(@event); | |||
_integrationEventLogContext.Database.UseTransaction(transaction); | |||
_integrationEventLogContext.IntegrationEventLogs.Add(eventLogEntry); | |||
return _integrationEventLogContext.SaveChangesAsync(); | |||
} | |||
public Task MarkEventAsPublishedAsync(IntegrationEvent @event) | |||
{ | |||
var eventLogEntry = _integrationEventLogContext.IntegrationEventLogs.Single(ie => ie.EventId == @event.Id); | |||
eventLogEntry.TimesSent++; | |||
eventLogEntry.State = EventStateEnum.Published; | |||
_integrationEventLogContext.IntegrationEventLogs.Update(eventLogEntry); | |||
return _integrationEventLogContext.SaveChangesAsync(); | |||
} | |||
} | |||
} |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "Basket.API.dll"] |
@ -0,0 +1,18 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.AspNetCore.Mvc; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Basket.API.Infrastructure.ActionResults | |||
{ | |||
public class InternalServerErrorObjectResult : ObjectResult | |||
{ | |||
public InternalServerErrorObjectResult(object error) | |||
: base(error) | |||
{ | |||
StatusCode = StatusCodes.Status500InternalServerError; | |||
} | |||
} | |||
} |
@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Basket.API.Infrastructure.Exceptions | |||
{ | |||
/// <summary> | |||
/// Exception type for app exceptions | |||
/// </summary> | |||
public class BasketDomainException : Exception | |||
{ | |||
public BasketDomainException() | |||
{ } | |||
public BasketDomainException(string message) | |||
: base(message) | |||
{ } | |||
public BasketDomainException(string message, Exception innerException) | |||
: base(message, innerException) | |||
{ } | |||
} | |||
} |
@ -0,0 +1,67 @@ | |||
using Basket.API.Infrastructure.ActionResults; | |||
using Basket.API.Infrastructure.Exceptions; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.AspNetCore.Mvc; | |||
using Microsoft.AspNetCore.Mvc.Filters; | |||
using Microsoft.Extensions.Logging; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Threading.Tasks; | |||
namespace Basket.API.Infrastructure.Filters | |||
{ | |||
public class HttpGlobalExceptionFilter : IExceptionFilter | |||
{ | |||
private readonly IHostingEnvironment env; | |||
private readonly ILogger<HttpGlobalExceptionFilter> logger; | |||
public HttpGlobalExceptionFilter(IHostingEnvironment env, ILogger<HttpGlobalExceptionFilter> logger) | |||
{ | |||
this.env = env; | |||
this.logger = logger; | |||
} | |||
public void OnException(ExceptionContext context) | |||
{ | |||
logger.LogError(new EventId(context.Exception.HResult), | |||
context.Exception, | |||
context.Exception.Message); | |||
if (context.Exception.GetType() == typeof(BasketDomainException)) | |||
{ | |||
var json = new JsonErrorResponse | |||
{ | |||
Messages = new[] { context.Exception.Message } | |||
}; | |||
context.Result = new BadRequestObjectResult(json); | |||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; | |||
} | |||
else | |||
{ | |||
var json = new JsonErrorResponse | |||
{ | |||
Messages = new[] { "An error ocurr.Try it again." } | |||
}; | |||
if (env.IsDevelopment()) | |||
{ | |||
json.DeveloperMeesage = context.Exception; | |||
} | |||
context.Result = new InternalServerErrorObjectResult(json); | |||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; | |||
} | |||
context.ExceptionHandled = true; | |||
} | |||
private class JsonErrorResponse | |||
{ | |||
public string[] Messages { get; set; } | |||
public object DeveloperMeesage { get; set; } | |||
} | |||
} | |||
} |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "Catalog.API.dll"] |
@ -0,0 +1,18 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.AspNetCore.Mvc; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Catalog.API.Infrastructure.ActionResults | |||
{ | |||
public class InternalServerErrorObjectResult : ObjectResult | |||
{ | |||
public InternalServerErrorObjectResult(object error) | |||
: base(error) | |||
{ | |||
StatusCode = StatusCodes.Status500InternalServerError; | |||
} | |||
} | |||
} |
@ -0,0 +1,99 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; | |||
namespace Catalog.API.Infrastructure.Migrations | |||
{ | |||
[DbContext(typeof(CatalogContext))] | |||
[Migration("20170322124244_RemoveIntegrationEventLogs")] | |||
partial class RemoveIntegrationEventLogs | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.1") | |||
.HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") | |||
.HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") | |||
.HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); | |||
b.Property<string>("Brand") | |||
.IsRequired() | |||
.HasMaxLength(100); | |||
b.HasKey("Id"); | |||
b.ToTable("CatalogBrand"); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); | |||
b.Property<int>("CatalogBrandId"); | |||
b.Property<int>("CatalogTypeId"); | |||
b.Property<string>("Description"); | |||
b.Property<string>("Name") | |||
.IsRequired() | |||
.HasMaxLength(50); | |||
b.Property<string>("PictureUri"); | |||
b.Property<decimal>("Price"); | |||
b.HasKey("Id"); | |||
b.HasIndex("CatalogBrandId"); | |||
b.HasIndex("CatalogTypeId"); | |||
b.ToTable("Catalog"); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(100); | |||
b.HasKey("Id"); | |||
b.ToTable("CatalogType"); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b => | |||
{ | |||
b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", "CatalogBrand") | |||
.WithMany() | |||
.HasForeignKey("CatalogBrandId") | |||
.OnDelete(DeleteBehavior.Cascade); | |||
b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", "CatalogType") | |||
.WithMany() | |||
.HasForeignKey("CatalogTypeId") | |||
.OnDelete(DeleteBehavior.Cascade); | |||
}); | |||
} | |||
} | |||
} |
@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
namespace Catalog.API.Infrastructure.Migrations | |||
{ | |||
public partial class RemoveIntegrationEventLogs : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropTable( | |||
name: "IntegrationEventLog"); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.CreateTable( | |||
name: "IntegrationEventLog", | |||
columns: table => new | |||
{ | |||
EventId = table.Column<Guid>(nullable: false), | |||
Content = table.Column<string>(nullable: false), | |||
CreationTime = table.Column<DateTime>(nullable: false), | |||
EventTypeName = table.Column<string>(nullable: false), | |||
State = table.Column<int>(nullable: false), | |||
TimesSent = table.Column<int>(nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_IntegrationEventLog", x => x.EventId); | |||
}); | |||
} | |||
} | |||
} |
@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Catalog.API.Infrastructure.Exceptions | |||
{ | |||
/// <summary> | |||
/// Exception type for app exceptions | |||
/// </summary> | |||
public class CatalogDomainException : Exception | |||
{ | |||
public CatalogDomainException() | |||
{ } | |||
public CatalogDomainException(string message) | |||
: base(message) | |||
{ } | |||
public CatalogDomainException(string message, Exception innerException) | |||
: base(message, innerException) | |||
{ } | |||
} | |||
} |
@ -0,0 +1,63 @@ | |||
using Catalog.API.Infrastructure.ActionResults; | |||
using Catalog.API.Infrastructure.Exceptions; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.AspNetCore.Mvc; | |||
using Microsoft.AspNetCore.Mvc.Filters; | |||
using Microsoft.Extensions.Logging; | |||
using System.Net; | |||
namespace Catalog.API.Infrastructure.Filters | |||
{ | |||
public class HttpGlobalExceptionFilter : IExceptionFilter | |||
{ | |||
private readonly IHostingEnvironment env; | |||
private readonly ILogger<HttpGlobalExceptionFilter> logger; | |||
public HttpGlobalExceptionFilter(IHostingEnvironment env, ILogger<HttpGlobalExceptionFilter> logger) | |||
{ | |||
this.env = env; | |||
this.logger = logger; | |||
} | |||
public void OnException(ExceptionContext context) | |||
{ | |||
logger.LogError(new EventId(context.Exception.HResult), | |||
context.Exception, | |||
context.Exception.Message); | |||
if (context.Exception.GetType() == typeof(CatalogDomainException)) | |||
{ | |||
var json = new JsonErrorResponse | |||
{ | |||
Messages = new[] { context.Exception.Message } | |||
}; | |||
context.Result = new BadRequestObjectResult(json); | |||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; | |||
} | |||
else | |||
{ | |||
var json = new JsonErrorResponse | |||
{ | |||
Messages = new[] { "An error ocurr.Try it again." } | |||
}; | |||
if (env.IsDevelopment()) | |||
{ | |||
json.DeveloperMeesage = context.Exception; | |||
} | |||
context.Result = new InternalServerErrorObjectResult(json); | |||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; | |||
} | |||
context.ExceptionHandled = true; | |||
} | |||
private class JsonErrorResponse | |||
{ | |||
public string[] Messages { get; set; } | |||
public object DeveloperMeesage { get; set; } | |||
} | |||
} | |||
} |
@ -0,0 +1,43 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | |||
namespace Catalog.API.Migrations | |||
{ | |||
[DbContext(typeof(IntegrationEventLogContext))] | |||
[Migration("20170322145434_IntegrationEventInitial")] | |||
partial class IntegrationEventInitial | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.1") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.IntegrationEventLogEntry", b => | |||
{ | |||
b.Property<Guid>("EventId") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<string>("Content") | |||
.IsRequired(); | |||
b.Property<DateTime>("CreationTime"); | |||
b.Property<string>("EventTypeName") | |||
.IsRequired(); | |||
b.Property<int>("State"); | |||
b.Property<int>("TimesSent"); | |||
b.HasKey("EventId"); | |||
b.ToTable("IntegrationEventLog"); | |||
}); | |||
} | |||
} | |||
} |
@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
namespace Catalog.API.Migrations | |||
{ | |||
public partial class IntegrationEventInitial : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.CreateTable( | |||
name: "IntegrationEventLog", | |||
columns: table => new | |||
{ | |||
EventId = table.Column<Guid>(nullable: false), | |||
Content = table.Column<string>(nullable: false), | |||
CreationTime = table.Column<DateTime>(nullable: false), | |||
EventTypeName = table.Column<string>(nullable: false), | |||
State = table.Column<int>(nullable: false), | |||
TimesSent = table.Column<int>(nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_IntegrationEventLog", x => x.EventId); | |||
}); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropTable( | |||
name: "IntegrationEventLog"); | |||
} | |||
} | |||
} |
@ -0,0 +1,42 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | |||
namespace Catalog.API.Migrations | |||
{ | |||
[DbContext(typeof(IntegrationEventLogContext))] | |||
partial class IntegrationEventLogContextModelSnapshot : ModelSnapshot | |||
{ | |||
protected override void BuildModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.1") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.IntegrationEventLogEntry", b => | |||
{ | |||
b.Property<Guid>("EventId") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<string>("Content") | |||
.IsRequired(); | |||
b.Property<DateTime>("CreationTime"); | |||
b.Property<string>("EventTypeName") | |||
.IsRequired(); | |||
b.Property<int>("State"); | |||
b.Property<int>("TimesSent"); | |||
b.HasKey("EventId"); | |||
b.ToTable("IntegrationEventLog"); | |||
}); | |||
} | |||
} | |||
} |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "Identity.API.dll"] |
@ -0,0 +1,46 @@ | |||
using FluentValidation; | |||
using MediatR; | |||
using Ordering.Domain.Exceptions; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Ordering.API.Application.Decorators | |||
{ | |||
public class ValidatorDecorator<TRequest, TResponse> | |||
: IAsyncRequestHandler<TRequest, TResponse> | |||
where TRequest : IAsyncRequest<TResponse> | |||
{ | |||
private readonly IAsyncRequestHandler<TRequest, TResponse> _inner; | |||
private readonly IValidator<TRequest>[] _validators; | |||
public ValidatorDecorator( | |||
IAsyncRequestHandler<TRequest, TResponse> inner, | |||
IValidator<TRequest>[] validators) | |||
{ | |||
_inner = inner; | |||
_validators = validators; | |||
} | |||
public async Task<TResponse> Handle(TRequest message) | |||
{ | |||
var failures = _validators | |||
.Select(v => v.Validate(message)) | |||
.SelectMany(result => result.Errors) | |||
.Where(error => error != null) | |||
.ToList(); | |||
if (failures.Any()) | |||
{ | |||
throw new OrderingDomainException( | |||
$"Command Validation Errors for type {typeof(TRequest).Name}", new ValidationException("Validation exception", failures)); | |||
} | |||
var response = await _inner.Handle(message); | |||
return response; | |||
} | |||
} | |||
} |
@ -0,0 +1,39 @@ | |||
using FluentValidation; | |||
using MediatR; | |||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand; | |||
namespace Ordering.API.Application.Validations | |||
{ | |||
public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand> | |||
{ | |||
public CreateOrderCommandValidator() | |||
{ | |||
RuleFor(order => order.City).NotEmpty(); | |||
RuleFor(order => order.Street).NotEmpty(); | |||
RuleFor(order => order.State).NotEmpty(); | |||
RuleFor(order => order.Country).NotEmpty(); | |||
RuleFor(order => order.ZipCode).NotEmpty(); | |||
RuleFor(order => order.CardNumber).NotEmpty().Length(12, 19); | |||
RuleFor(order => order.CardHolderName).NotEmpty(); | |||
RuleFor(order => order.CardExpiration).NotEmpty().Must(BeValidExpirationDate).WithMessage("Please specify a valid card expiration date"); | |||
RuleFor(order => order.CardSecurityNumber).NotEmpty().Length(3); | |||
RuleFor(order => order.CardTypeId).NotEmpty(); | |||
RuleFor(order => order.OrderItems).Must(ContainOrderItems).WithMessage("No order items found"); | |||
} | |||
private bool BeValidExpirationDate(DateTime dateTime) | |||
{ | |||
return dateTime >= DateTime.UtcNow; | |||
} | |||
private bool ContainOrderItems(IEnumerable<OrderItemDTO> orderItems) | |||
{ | |||
return orderItems.Any(); | |||
} | |||
} | |||
} |
@ -0,0 +1,17 @@ | |||
using FluentValidation; | |||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Ordering.API.Application.Validations | |||
{ | |||
public class IdentifierCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand,bool>> | |||
{ | |||
public IdentifierCommandValidator() | |||
{ | |||
RuleFor(customer => customer.Id).NotEmpty(); | |||
} | |||
} | |||
} |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "Ordering.API.dll"] |
@ -0,0 +1,23 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace Ordering.Domain.Exceptions | |||
{ | |||
/// <summary> | |||
/// Exception type for domain exceptions | |||
/// </summary> | |||
public class OrderingDomainException : Exception | |||
{ | |||
public OrderingDomainException() | |||
{ } | |||
public OrderingDomainException(string message) | |||
: base(message) | |||
{ } | |||
public OrderingDomainException(string message, Exception innerException) | |||
: base(message, innerException) | |||
{ } | |||
} | |||
} |
@ -0,0 +1,305 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<Import Project="..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" /> | |||
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" /> | |||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProductVersion> | |||
</ProductVersion> | |||
<SchemaVersion>2.0</SchemaVersion> | |||
<ProjectGuid>{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}</ProjectGuid> | |||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<RootNamespace>Microsoft.eShopOnContainers.Catalog.WebForms</RootNamespace> | |||
<AssemblyName>Catalog.WebForms</AssemblyName> | |||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | |||
<UseIISExpress>true</UseIISExpress> | |||
<IISExpressSSLPort /> | |||
<IISExpressAnonymousAuthentication /> | |||
<IISExpressWindowsAuthentication /> | |||
<IISExpressUseClassicPipelineMode /> | |||
<UseGlobalApplicationHostFile /> | |||
<NuGetPackageImportStamp> | |||
</NuGetPackageImportStamp> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>bin\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>bin\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Autofac, Version=4.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Autofac.4.3.0\lib\net45\Autofac.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.ComponentModel.DataAnnotations" /> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="System.Web.Extensions" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="System.Drawing" /> | |||
<Reference Include="System.Web" /> | |||
<Reference Include="System.Xml" /> | |||
<Reference Include="System.Configuration" /> | |||
<Reference Include="System.Web.Services" /> | |||
<Reference Include="System.EnterpriseServices" /> | |||
<Reference Include="System.Web.DynamicData" /> | |||
<Reference Include="System.Web.Entity" /> | |||
<Reference Include="System.Web.ApplicationServices" /> | |||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<Private>True</Private> | |||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> | |||
</Reference> | |||
<Reference Include="AspNet.ScriptManager.bootstrap"> | |||
<HintPath>..\packages\AspNet.ScriptManager.bootstrap.3.0.0\lib\net45\AspNet.ScriptManager.bootstrap.dll</HintPath> | |||
</Reference> | |||
<Reference Include="AspNet.ScriptManager.jQuery"> | |||
<HintPath>..\packages\AspNet.ScriptManager.jQuery.1.10.2\lib\net45\AspNet.ScriptManager.jQuery.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.ScriptManager.MSAjax"> | |||
<HintPath>..\packages\Microsoft.AspNet.ScriptManager.MSAjax.5.0.0\lib\net45\Microsoft.ScriptManager.MSAjax.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.ScriptManager.WebForms"> | |||
<HintPath>..\packages\Microsoft.AspNet.ScriptManager.WebForms.5.0.0\lib\net45\Microsoft.ScriptManager.WebForms.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> | |||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath> | |||
</Reference> | |||
<Reference Include="WebGrease"> | |||
<Private>True</Private> | |||
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Antlr3.Runtime"> | |||
<Private>True</Private> | |||
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AspNet.Web.Optimization.WebForms"> | |||
<Private>True</Private> | |||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.WebForms.1.1.3\lib\net45\Microsoft.AspNet.Web.Optimization.WebForms.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AspNet.FriendlyUrls"> | |||
<HintPath>..\packages\Microsoft.AspNet.FriendlyUrls.Core.1.0.2\lib\net45\Microsoft.AspNet.FriendlyUrls.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="Newtonsoft.Json"> | |||
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.ApplicationInsights"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.Agent.Intercept"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.DependencyCollector"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.PerfCounterCollector"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.ServerTelemetryChannel"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.WindowsServer"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.AI.Web"> | |||
<HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="About.aspx" /> | |||
<Content Include="Contact.aspx" /> | |||
<Content Include="Content\bootstrap.css" /> | |||
<Content Include="Content\bootstrap.min.css" /> | |||
<Content Include="Content\fake_product_01.png" /> | |||
<Content Include="Content\fake_product_02.png" /> | |||
<Content Include="Content\fake_product_03.png" /> | |||
<Content Include="Content\fake_product_04.png" /> | |||
<Content Include="Content\fake_product_05.png" /> | |||
<Content Include="Content\Site.css" /> | |||
<Content Include="Default.aspx" /> | |||
<Content Include="favicon.ico" /> | |||
<Content Include="fonts\glyphicons-halflings-regular.svg" /> | |||
<Content Include="Global.asax" /> | |||
<Content Include="fonts\glyphicons-halflings-regular.woff" /> | |||
<Content Include="fonts\glyphicons-halflings-regular.ttf" /> | |||
<Content Include="fonts\glyphicons-halflings-regular.eot" /> | |||
<Content Include="ApplicationInsights.config"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<None Include="Dockerfile" /> | |||
<None Include=".dockerignore"> | |||
<DependentUpon>Dockerfile</DependentUpon> | |||
</None> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<None Include="Scripts\jquery-1.10.2.intellisense.js" /> | |||
<Content Include="Scripts\bootstrap.js" /> | |||
<Content Include="Scripts\bootstrap.min.js" /> | |||
<Content Include="Scripts\jquery-1.10.2.js" /> | |||
<Content Include="Scripts\jquery-1.10.2.min.js" /> | |||
<Content Include="Scripts\modernizr-2.6.2.js" /> | |||
<Content Include="Scripts\respond.js" /> | |||
<Content Include="Scripts\respond.min.js" /> | |||
<Content Include="Scripts\WebForms\DetailsView.js" /> | |||
<Content Include="Scripts\WebForms\Focus.js" /> | |||
<Content Include="Scripts\WebForms\GridView.js" /> | |||
<Content Include="Scripts\WebForms\Menu.js" /> | |||
<Content Include="Scripts\WebForms\MenuStandards.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjax.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxApplicationServices.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxComponentModel.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxCore.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxGlobalization.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxHistory.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxNetwork.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxSerialization.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxTimer.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebForms.js" /> | |||
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebServices.js" /> | |||
<Content Include="Scripts\WebForms\SmartNav.js" /> | |||
<Content Include="Scripts\WebForms\TreeView.js" /> | |||
<Content Include="Scripts\WebForms\WebForms.js" /> | |||
<Content Include="Scripts\WebForms\WebParts.js" /> | |||
<Content Include="Scripts\WebForms\WebUIValidation.js" /> | |||
<Content Include="Site.Master" /> | |||
<Content Include="ViewSwitcher.ascx" /> | |||
<Content Include="Web.config" /> | |||
<Content Include="Bundle.config" /> | |||
<Content Include="Site.Mobile.Master" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="App_Start\BundleConfig.cs" /> | |||
<Compile Include="About.aspx.cs"> | |||
<DependentUpon>About.aspx</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="About.aspx.designer.cs"> | |||
<DependentUpon>About.aspx</DependentUpon> | |||
</Compile> | |||
<Compile Include="App_Start\RouteConfig.cs" /> | |||
<Compile Include="Contact.aspx.cs"> | |||
<DependentUpon>Contact.aspx</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="Contact.aspx.designer.cs"> | |||
<DependentUpon>Contact.aspx</DependentUpon> | |||
</Compile> | |||
<Compile Include="Default.aspx.cs"> | |||
<DependentUpon>Default.aspx</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="Default.aspx.designer.cs"> | |||
<DependentUpon>Default.aspx</DependentUpon> | |||
</Compile> | |||
<Compile Include="Extensions\ObservableExtensions.cs" /> | |||
<Compile Include="Global.asax.cs"> | |||
<DependentUpon>Global.asax</DependentUpon> | |||
</Compile> | |||
<Compile Include="Models\CatalogBrand.cs" /> | |||
<Compile Include="Models\CatalogItem.cs" /> | |||
<Compile Include="Models\CatalogRoot.cs" /> | |||
<Compile Include="Models\CatalogType.cs" /> | |||
<Compile Include="Modules\AutoFacHttpModule.cs" /> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
<Compile Include="Services\CatalogMockService.cs" /> | |||
<Compile Include="Services\CatalogService.cs" /> | |||
<Compile Include="Services\Common.cs" /> | |||
<Compile Include="Services\ICatalogService.cs" /> | |||
<Compile Include="Services\IRouteProvider.cs" /> | |||
<Compile Include="Site.Master.cs"> | |||
<DependentUpon>Site.Master</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="Site.Master.designer.cs"> | |||
<DependentUpon>Site.Master</DependentUpon> | |||
</Compile> | |||
<Compile Include="Site.Mobile.Master.cs"> | |||
<DependentUpon>Site.Mobile.Master</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="Site.Mobile.Master.designer.cs"> | |||
<DependentUpon>Site.Mobile.Master</DependentUpon> | |||
</Compile> | |||
<Compile Include="ViewSwitcher.ascx.cs"> | |||
<DependentUpon>ViewSwitcher.ascx</DependentUpon> | |||
<SubType>ASPXCodeBehind</SubType> | |||
</Compile> | |||
<Compile Include="ViewSwitcher.ascx.designer.cs"> | |||
<DependentUpon>ViewSwitcher.ascx</DependentUpon> | |||
</Compile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="App_Data\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="packages.config" /> | |||
<Content Include="Scripts\jquery-1.10.2.min.map" /> | |||
<None Include="Web.Debug.config"> | |||
<DependentUpon>Web.config</DependentUpon> | |||
</None> | |||
<None Include="Web.Release.config"> | |||
<DependentUpon>Web.config</DependentUpon> | |||
</None> | |||
</ItemGroup> | |||
<PropertyGroup> | |||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | |||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | |||
</PropertyGroup> | |||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | |||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> | |||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> | |||
<ProjectExtensions> | |||
<VisualStudio> | |||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> | |||
<WebProjectProperties> | |||
<UseIIS>True</UseIIS> | |||
<AutoAssignPort>True</AutoAssignPort> | |||
<DevelopmentServerPort>58178</DevelopmentServerPort> | |||
<DevelopmentServerVPath>/</DevelopmentServerVPath> | |||
<IISUrl>http://localhost:58178/</IISUrl> | |||
<NTLMAuthentication>False</NTLMAuthentication> | |||
<UseCustomServer>False</UseCustomServer> | |||
<CustomServerUrl> | |||
</CustomServerUrl> | |||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> | |||
</WebProjectProperties> | |||
</FlavorProperties> | |||
</VisualStudio> | |||
</ProjectExtensions> | |||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | |||
<PropertyGroup> | |||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | |||
</PropertyGroup> | |||
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> | |||
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props'))" /> | |||
</Target> | |||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
Other similar extension points exist, see Microsoft.Common.targets. | |||
<Target Name="BeforeBuild"> | |||
</Target> | |||
<Target Name="AfterBuild"> | |||
</Target> | |||
--> | |||
</Project> |
@ -0,0 +1,45 @@ | |||
using Autofac; | |||
using Autofac.Core; | |||
using eShopOnContainers.Core.Models.Catalog; | |||
using eShopOnContainers.Core.Services.Catalog; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using System.Web.UI; | |||
using System.Web.UI.WebControls; | |||
namespace Microsoft.eShopOnContainers.Catalog.WebForms | |||
{ | |||
public partial class _Default : Page | |||
{ | |||
private ICatalogService catalog; | |||
protected _Default() { } | |||
public _Default(ICatalogService catalog) | |||
{ | |||
this.catalog = catalog; | |||
} | |||
protected override void OnLoad(EventArgs e) | |||
{ | |||
RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync)); | |||
base.OnLoad(e); | |||
} | |||
private async Task LoadCatalogDataAsync() | |||
{ | |||
var collection = await catalog?.GetCatalogAsync(); | |||
catalogList.DataSource = collection; | |||
catalogList.DataBind(); | |||
} | |||
protected void Page_Load(object sender, EventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@ -0,0 +1,19 @@ | |||
using System; | |||
using System.Web; | |||
using System.Web.Optimization; | |||
using System.Web.Routing; | |||
namespace Microsoft.eShopOnContainers.Catalog.WebForms | |||
{ | |||
public class Global : HttpApplication | |||
{ | |||
void Application_Start(object sender, EventArgs e) | |||
{ | |||
// Code that runs on application startup | |||
RouteConfig.RegisterRoutes(RouteTable.Routes); | |||
BundleConfig.RegisterBundles(BundleTable.Bundles); | |||
} | |||
} | |||
} |
@ -0,0 +1,83 @@ | |||
using Autofac; | |||
using eShopOnContainers.Core.Services.Catalog; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Web; | |||
using System.Web.Configuration; | |||
using System.Web.UI; | |||
namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules | |||
{ | |||
// Using DI with WebForms is not yet implemented. | |||
// This implementation has been adapted from this post: | |||
// https://blogs.msdn.microsoft.com/webdev/2016/10/19/modern-asp-net-web-forms-development-dependency-injection/ | |||
public class AutoFacHttpModule : IHttpModule | |||
{ | |||
private static IContainer Container => lazyContainer.Value; | |||
private static Lazy<IContainer> lazyContainer = new Lazy<IContainer>(() => CreateContainer()); | |||
private static IContainer CreateContainer() | |||
{ | |||
// Configure AutoFac: | |||
// Register Containers: | |||
var settings = WebConfigurationManager.AppSettings; | |||
var useFake = settings["usefake"]; | |||
bool fake = useFake == "true"; | |||
var builder = new ContainerBuilder(); | |||
if (fake) | |||
{ | |||
builder.RegisterType<CatalogMockService>() | |||
.As<ICatalogService>(); | |||
} | |||
else | |||
{ | |||
builder.RegisterType<CatalogMockService>() | |||
.As<ICatalogService>(); | |||
} | |||
var container = builder.Build(); | |||
return container; | |||
} | |||
public void Dispose() | |||
{ | |||
Container.Dispose(); | |||
} | |||
public void Init(HttpApplication context) | |||
{ | |||
context.PreRequestHandlerExecute += (_, __) => InjectDependencies(); | |||
} | |||
private void InjectDependencies() | |||
{ | |||
if (HttpContext.Current.CurrentHandler is Page page) | |||
{ | |||
// Get the code-behind class that we may have written | |||
var pageType = page.GetType().BaseType; | |||
// Determine if there is a constructor to inject, and grab it | |||
var ctor = (from c in pageType.GetConstructors() | |||
where c.GetParameters().Length > 0 | |||
select c).FirstOrDefault(); | |||
if (ctor != null) | |||
{ | |||
// Resolve the parameters for the constructor | |||
var args = (from parm in ctor.GetParameters() | |||
select Container.Resolve(parm.ParameterType)) | |||
.ToArray(); | |||
// Execute the constructor method with the arguments resolved | |||
ctor.Invoke(page, args); | |||
} | |||
// Use the Autofac method to inject any properties that can be filled by Autofac | |||
Container.InjectProperties(page); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,54 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
For more information on how to configure your ASP.NET application, please visit | |||
https://go.microsoft.com/fwlink/?LinkId=169433 | |||
--> | |||
<configuration> | |||
<appSettings> | |||
<add key="usefake" value="true" /> | |||
</appSettings> | |||
<system.web> | |||
<compilation debug="true" targetFramework="4.5.2" /> | |||
<httpRuntime targetFramework="4.5.2" /> | |||
<pages> | |||
<namespaces> | |||
<add namespace="System.Web.Optimization" /> | |||
</namespaces> | |||
<controls> | |||
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /> | |||
</controls> | |||
</pages> | |||
<httpModules> | |||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> | |||
<!-- Use this if you are on IIS 7 and earlier --> | |||
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> | |||
</httpModules> | |||
</system.web> | |||
<runtime> | |||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |||
<dependentAssembly> | |||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | |||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /> | |||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
<system.webServer> | |||
<validation validateIntegratedModeConfiguration="false" /> | |||
<modules> | |||
<remove name="ApplicationInsightsWebTracking" /> | |||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> | |||
<!-- Use this if you are on IIS 8 and later --> | |||
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> | |||
</modules> | |||
</system.webServer> | |||
<system.codedom> | |||
<compilers> | |||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> | |||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> | |||
</compilers> | |||
</system.codedom> | |||
</configuration> |
@ -0,0 +1,29 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<packages> | |||
<package id="Antlr" version="3.4.1.9004" targetFramework="net452" /> | |||
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" /> | |||
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" /> | |||
<package id="Autofac" version="4.3.0" targetFramework="net452" /> | |||
<package id="bootstrap" version="3.0.0" targetFramework="net452" /> | |||
<package id="jQuery" version="1.10.2" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" /> | |||
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" /> | |||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" /> | |||
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" /> | |||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" /> | |||
<package id="Modernizr" version="2.6.2" targetFramework="net452" /> | |||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" /> | |||
<package id="Respond" version="1.2.0" targetFramework="net452" /> | |||
<package id="WebGrease" version="1.5.2" targetFramework="net452" /> | |||
</packages> |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "WebMVC.dll"] |
@ -0,0 +1,8 @@ | |||
FROM microsoft/dotnet:1.1-runtime-nanoserver | |||
SHELL ["powershell"] | |||
ARG source | |||
WORKDIR /app | |||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | |||
EXPOSE 80 | |||
COPY ${source:-obj/Docker/publish} . | |||
ENTRYPOINT ["dotnet", "WebSPA.dll"] |
@ -0,0 +1,18 @@ | |||
using Microsoft.AspNetCore.TestHost; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Net.Http; | |||
using System.Text; | |||
namespace FunctionalTests.Extensions | |||
{ | |||
static class HttpClientExtensions | |||
{ | |||
public static HttpClient CreateIdempotentClient(this TestServer server) | |||
{ | |||
var client = server.CreateClient(); | |||
client.DefaultRequestHeaders.Add("x-requestid", Guid.NewGuid().ToString()); | |||
return client; | |||
} | |||
} | |||
} |
@ -0,0 +1,18 @@ | |||
using Microsoft.AspNetCore.TestHost; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Net.Http; | |||
using System.Text; | |||
namespace IntegrationTests.Services.Extensions | |||
{ | |||
static class HttpClientExtensions | |||
{ | |||
public static HttpClient CreateIdempotentClient(this TestServer server) | |||
{ | |||
var client = server.CreateClient(); | |||
client.DefaultRequestHeaders.Add("x-requestid", Guid.NewGuid().ToString()); | |||
return client; | |||
} | |||
} | |||
} |