mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
Initial commit
This commit is contained in:
parent
f7cc057037
commit
f2066234b0
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.1.22076.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.1.22076.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -24,4 +24,10 @@
|
||||||
<Folder Include="wwwroot\images\" />
|
<Folder Include="wwwroot\images\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<RuntimeHostConfigurationOption
|
||||||
|
Include="System.Net.SocketsHttpHandler.Http3Support"
|
||||||
|
Value="true" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; // IdentityUser
|
||||||
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
|
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
|
||||||
using Northwind.Mvc.Data; // ApplicationDbContext
|
using Northwind.Mvc.Data; // ApplicationDbContext
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
|
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
|
||||||
|
|
||||||
// Section 2 - configure the host web server including services
|
// Section 2 - configure the host web server including services
|
||||||
|
|
@ -40,7 +41,11 @@ builder.Services.AddNorthwindContext();
|
||||||
builder.Services.AddHttpClient(name: "Northwind.WebApi",
|
builder.Services.AddHttpClient(name: "Northwind.WebApi",
|
||||||
configureClient: options =>
|
configureClient: options =>
|
||||||
{
|
{
|
||||||
|
options.DefaultRequestVersion = HttpVersion.Version30;
|
||||||
|
options.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
|
||||||
|
|
||||||
options.BaseAddress = new Uri("https://localhost:5002/");
|
options.BaseAddress = new Uri("https://localhost:5002/");
|
||||||
|
|
||||||
options.DefaultRequestHeaders.Accept.Add(
|
options.DefaultRequestHeaders.Accept.Add(
|
||||||
new MediaTypeWithQualityHeaderValue(
|
new MediaTypeWithQualityHeaderValue(
|
||||||
mediaType: "application/json", quality: 1.0));
|
mediaType: "application/json", quality: 1.0));
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<!--remove the element below after GA release-->
|
|
||||||
|
<!--remove the elements below after GA release-->
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
|
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
|
|
||||||
// configure services
|
// configure services
|
||||||
|
|
@ -5,6 +6,16 @@ using Packt.Shared; // AddNorthwindContext extension method
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
builder.Services.AddNorthwindContext();
|
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();
|
var app = builder.Build();
|
||||||
|
|
||||||
// configure the HTTP pipeline
|
// configure the HTTP pipeline
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
|
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
|
||||||
|
|
||||||
|
<!--remove the elements below after GA release-->
|
||||||
|
<LangVersion>preview</LangVersion>
|
||||||
|
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; // IOutputFormatter, OutputFormatter
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
|
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
|
||||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|
@ -39,6 +40,15 @@ builder.Services.AddScoped<ICustomerRepository, CustomerRepository>();
|
||||||
builder.Services.AddHealthChecks()
|
builder.Services.AddHealthChecks()
|
||||||
.AddDbContextCheck<NorthwindContext>();
|
.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();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-preview.1.22109.13" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.1.22076.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-*" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.1.22076.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -24,4 +24,10 @@
|
||||||
<Folder Include="wwwroot\images\" />
|
<Folder Include="wwwroot\images\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<RuntimeHostConfigurationOption
|
||||||
|
Include="System.Net.SocketsHttpHandler.Http3Support"
|
||||||
|
Value="true" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; // IdentityUser
|
||||||
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
|
using Microsoft.EntityFrameworkCore; // UseSqlServer, UseSqlite
|
||||||
using Northwind.Mvc.Data; // ApplicationDbContext
|
using Northwind.Mvc.Data; // ApplicationDbContext
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
|
using System.Net.Http.Headers; // MediaTypeWithQualityHeaderValue
|
||||||
|
|
||||||
// Section 2 - configure the host web server including services
|
// Section 2 - configure the host web server including services
|
||||||
|
|
@ -40,7 +41,11 @@ builder.Services.AddNorthwindContext();
|
||||||
builder.Services.AddHttpClient(name: "Northwind.WebApi",
|
builder.Services.AddHttpClient(name: "Northwind.WebApi",
|
||||||
configureClient: options =>
|
configureClient: options =>
|
||||||
{
|
{
|
||||||
|
options.DefaultRequestVersion = HttpVersion.Version30;
|
||||||
|
options.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
|
||||||
|
|
||||||
options.BaseAddress = new Uri("https://localhost:5002/");
|
options.BaseAddress = new Uri("https://localhost:5002/");
|
||||||
|
|
||||||
options.DefaultRequestHeaders.Accept.Add(
|
options.DefaultRequestHeaders.Accept.Add(
|
||||||
new MediaTypeWithQualityHeaderValue(
|
new MediaTypeWithQualityHeaderValue(
|
||||||
mediaType: "application/json", quality: 1.0));
|
mediaType: "application/json", quality: 1.0));
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<!--remove the element below after GA release-->
|
|
||||||
|
<!--remove the elements below after GA release-->
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
|
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
|
|
||||||
// configure services
|
// configure services
|
||||||
|
|
@ -5,6 +6,16 @@ using Packt.Shared; // AddNorthwindContext extension method
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
builder.Services.AddNorthwindContext();
|
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();
|
var app = builder.Build();
|
||||||
|
|
||||||
// configure the HTTP pipeline
|
// configure the HTTP pipeline
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
|
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
|
||||||
|
|
||||||
|
<!--remove the elements below after GA release-->
|
||||||
|
<LangVersion>preview</LangVersion>
|
||||||
|
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; // IOutputFormatter, OutputFormatter
|
||||||
using Packt.Shared; // AddNorthwindContext extension method
|
using Packt.Shared; // AddNorthwindContext extension method
|
||||||
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
|
using Northwind.WebApi.Repositories; // ICustomerRepository, CustomerRepository
|
||||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core; // HttpProtocols
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|
@ -39,6 +40,15 @@ builder.Services.AddScoped<ICustomerRepository, CustomerRepository>();
|
||||||
builder.Services.AddHealthChecks()
|
builder.Services.AddHealthChecks()
|
||||||
.AddDbContextCheck<NorthwindContext>();
|
.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();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue