Skip to content

Commit d5586b9

Browse files
committed
Update to .NET 6
1 parent a7c631b commit d5586b9

File tree

7 files changed

+55
-92
lines changed

7 files changed

+55
-92
lines changed

src/Store.Infrastructure/Migrations/20211030013526_InitialCreate.Designer.cs renamed to src/Store.Infrastructure/Migrations/20211108211740_InitialCreate.Designer.cs

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Store.Infrastructure/Migrations/20211030013526_InitialCreate.cs renamed to src/Store.Infrastructure/Migrations/20211108211740_InitialCreate.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using Microsoft.EntityFrameworkCore.Migrations;
33

4+
#nullable disable
5+
46
namespace Store.Infrastructure.Migrations
57
{
68
public partial class InitialCreate : Migration

src/Store.Infrastructure/Migrations/StoreContextModelSnapshot.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
77
using Store.Infrastructure.Persistence.Contexts;
88

9+
#nullable disable
10+
911
namespace Store.Infrastructure.Migrations
1012
{
1113
[DbContext(typeof(StoreContext))]
@@ -15,16 +17,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1517
{
1618
#pragma warning disable 612, 618
1719
modelBuilder
18-
.HasAnnotation("Relational:MaxIdentifierLength", 128)
19-
.HasAnnotation("ProductVersion", "5.0.11")
20-
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
20+
.HasAnnotation("ProductVersion", "6.0.0")
21+
.HasAnnotation("Relational:MaxIdentifierLength", 128);
22+
23+
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
2124

2225
modelBuilder.Entity("Store.ApplicationCore.Entities.Product", b =>
2326
{
2427
b.Property<int>("Id")
2528
.ValueGeneratedOnAdd()
26-
.HasColumnType("int")
27-
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
29+
.HasColumnType("int");
30+
31+
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
2832

2933
b.Property<DateTime>("CreatedAt")
3034
.HasColumnType("datetime2");

src/Store.Infrastructure/Store.Infrastructure.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>disable</ImplicitUsings>
56
</PropertyGroup>
67

78
<ItemGroup>
8-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.11" />
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
910
</ItemGroup>
1011

1112
<ItemGroup>

src/Store.WebApi/Program.cs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1-
using Microsoft.AspNetCore.Hosting;
2-
using Microsoft.Extensions.Configuration;
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.Extensions.DependencyInjection;
33
using Microsoft.Extensions.Hosting;
4-
using Microsoft.Extensions.Logging;
5-
using System;
6-
using System.Collections.Generic;
7-
using System.Linq;
8-
using System.Threading.Tasks;
4+
using Store.ApplicationCore;
5+
using Store.Infrastructure;
96

10-
namespace Store.WebApi
7+
var builder = WebApplication.CreateBuilder(args);
8+
9+
// Add services to the container.
10+
11+
builder.Services.AddApplicationCore();
12+
builder.Services.AddInfrastructure(builder.Configuration);
13+
builder.Services.AddControllers();
14+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
15+
builder.Services.AddEndpointsApiExplorer();
16+
builder.Services.AddSwaggerGen();
17+
18+
var app = builder.Build();
19+
20+
// Configure the HTTP request pipeline.
21+
if (app.Environment.IsDevelopment())
1122
{
12-
public class Program
13-
{
14-
public static void Main(string[] args)
15-
{
16-
CreateHostBuilder(args).Build().Run();
17-
}
18-
19-
public static IHostBuilder CreateHostBuilder(string[] args) =>
20-
Host.CreateDefaultBuilder(args)
21-
.ConfigureWebHostDefaults(webBuilder =>
22-
{
23-
webBuilder.UseStartup<Startup>();
24-
});
25-
}
23+
app.UseSwagger();
24+
app.UseSwaggerUI();
2625
}
26+
27+
app.UseAuthorization();
28+
29+
app.MapControllers();
30+
31+
app.Run();

src/Store.WebApi/Startup.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/Store.WebApi/Store.WebApi.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>disable</ImplicitUsings>
56
</PropertyGroup>
67

78
<ItemGroup>
8-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.11">
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
910
<PrivateAssets>all</PrivateAssets>
1011
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1112
</PackageReference>
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.11">
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
1314
<PrivateAssets>all</PrivateAssets>
1415
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1516
</PackageReference>

0 commit comments

Comments
 (0)