Initial commit

This commit is contained in:
Mark J Price 2022-03-15 11:01:57 +00:00
parent f7cc057037
commit f2066234b0
18 changed files with 98 additions and 18 deletions

View file

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0-*" />
</ItemGroup>
<ItemGroup>

View file

@ -8,11 +8,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.1.22076.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.1.22076.6" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-*" />
</ItemGroup>
<ItemGroup>
@ -24,4 +24,10 @@
<Folder Include="wwwroot\images\" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption
Include="System.Net.SocketsHttpHandler.Http3Support"
Value="true" />
</ItemGroup>
</Project>

View file

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; // IdentityUser
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
using Northwind.Mvc.Data; // ApplicationDbContext
using Packt.Shared; // AddNorthwindContext extension method
using System.Net;
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
// Section 2 - configure the host web server including services
@ -40,7 +41,11 @@ builder.Services.AddNorthwindContext();
builder.Services.AddHttpClient(name: "Northwind.WebApi",
configureClient: options =>
{
options.DefaultRequestVersion = HttpVersion.Version30;
options.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
options.BaseAddress = new Uri("https://localhost:5002/");
options.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue(
mediaType: "application/json", quality: 1.0));

View file

@ -4,8 +4,10 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!--remove the element below after GA release-->
<!--remove the elements below after GA release-->
<LangVersion>preview</LangVersion>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
<ItemGroup>

View file

@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
using Packt.Shared; // AddNorthwindContext extension method
// configure services
@ -5,6 +6,16 @@ using Packt.Shared; // AddNorthwindContext extension method
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddNorthwindContext();
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.ListenAnyIP(5001, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps(); // HTTP/3 requires secure connections
});
});
var app = builder.Build();
// configure the HTTP pipeline

View file

@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
}
},
"AllowedHosts": "*"

View file

@ -5,6 +5,10 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
<!--remove the elements below after GA release-->
<LangVersion>preview</LangVersion>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
<ItemGroup>

View file

@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; // IOutputFormatter, OutputFormatter
using Packt.Shared; // AddNorthwindContext extension method
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
using Swashbuckle.AspNetCore.SwaggerUI;
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
var builder = WebApplication.CreateBuilder(args);
@ -39,6 +40,15 @@ builder.Services.AddScoped<ICustomerRepository, CustomerRepository>();
builder.Services.AddHealthChecks()
.AddDbContextCheck<NorthwindContext>();
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.ListenAnyIP(5002, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps(); // HTTP/3 requires secure connections
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.

View file

@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
}
},
"AllowedHosts": "*"

View file

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0-*" />
</ItemGroup>
<ItemGroup>

View file

@ -8,11 +8,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-preview.1.22109.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.1.22076.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.1.22076.6" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-*" />
</ItemGroup>
<ItemGroup>
@ -24,4 +24,10 @@
<Folder Include="wwwroot\images\" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption
Include="System.Net.SocketsHttpHandler.Http3Support"
Value="true" />
</ItemGroup>
</Project>

View file

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; // IdentityUser
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
using Northwind.Mvc.Data; // ApplicationDbContext
using Packt.Shared; // AddNorthwindContext extension method
using System.Net;
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
// Section 2 - configure the host web server including services
@ -40,7 +41,11 @@ builder.Services.AddNorthwindContext();
builder.Services.AddHttpClient(name: "Northwind.WebApi",
configureClient: options =>
{
options.DefaultRequestVersion = HttpVersion.Version30;
options.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
options.BaseAddress = new Uri("https://localhost:5002/");
options.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue(
mediaType: "application/json", quality: 1.0));

View file

@ -4,8 +4,10 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!--remove the element below after GA release-->
<!--remove the elements below after GA release-->
<LangVersion>preview</LangVersion>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
<ItemGroup>

View file

@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
using Packt.Shared; // AddNorthwindContext extension method
// configure services
@ -5,6 +6,16 @@ using Packt.Shared; // AddNorthwindContext extension method
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddNorthwindContext();
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.ListenAnyIP(5001, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps(); // HTTP/3 requires secure connections
});
});
var app = builder.Build();
// configure the HTTP pipeline

View file

@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
}
},
"AllowedHosts": "*"

View file

@ -5,6 +5,10 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
<!--remove the elements below after GA release-->
<LangVersion>preview</LangVersion>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
<ItemGroup>

View file

@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; // IOutputFormatter, OutputFormatter
using Packt.Shared; // AddNorthwindContext extension method
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
using Swashbuckle.AspNetCore.SwaggerUI;
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
var builder = WebApplication.CreateBuilder(args);
@ -39,6 +40,15 @@ builder.Services.AddScoped<ICustomerRepository, CustomerRepository>();
builder.Services.AddHealthChecks()
.AddDbContextCheck<NorthwindContext>();
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.ListenAnyIP(5002, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps(); // HTTP/3 requires secure connections
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.

View file

@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
}
},
"AllowedHosts": "*"