provide functionality for connecting with a PostgreSQL database

This commit is contained in:
2025-04-08 13:30:57 +02:00
parent 193cc02ed3
commit dfcdcfe20f
7 changed files with 214 additions and 203 deletions

5
.gitignore vendored
View File

@@ -360,4 +360,7 @@ MigrationBackup/
.ionide/ .ionide/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
# Don't push database credentials stored in appsettings.json!
*/appsettings.json

View File

@@ -1,224 +1,228 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using WebApp.Data; using WebApp.Data;
namespace WebApp.Data.Migrations #nullable disable
namespace WebApp.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("00000000000000_CreateIdentitySchema")] [Migration("20250408112459_InitialDataStore")]
partial class CreateIdentitySchema partial class InitialDataStore
{ {
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.IsUnique() .IsUnique()
.HasName("RoleNameIndex") .HasDatabaseName("RoleNameIndex");
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("integer");
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd") b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("PasswordHash") b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed") b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<bool>("TwoFactorEnabled") b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
.HasName("EmailIndex"); .HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName") b.HasIndex("NormalizedUserName")
.IsUnique() .IsUnique()
.HasName("UserNameIndex") .HasDatabaseName("UserNameIndex");
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers"); b.ToTable("AspNetUsers", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("integer");
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>

View File

@@ -1,21 +1,25 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace WebApp.Data.Migrations #nullable disable
namespace WebApp.Migrations
{ {
public partial class CreateIdentitySchema : Migration /// <inheritdoc />
public partial class InitialDataStore : Migration
{ {
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "AspNetRoles", name: "AspNetRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: true), Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true), NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true) ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -26,21 +30,21 @@ namespace WebApp.Data.Migrations
name: "AspNetUsers", name: "AspNetUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<string>(type: "text", nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true), UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true), NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true), Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false), EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(nullable: true), PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(nullable: true), SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true), ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(nullable: true), PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false), PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false), TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false), LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(nullable: false) AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -51,11 +55,11 @@ namespace WebApp.Data.Migrations
name: "AspNetRoleClaims", name: "AspNetRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(nullable: false), RoleId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -72,11 +76,11 @@ namespace WebApp.Data.Migrations
name: "AspNetUserClaims", name: "AspNetUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -93,10 +97,10 @@ namespace WebApp.Data.Migrations
name: "AspNetUserLogins", name: "AspNetUserLogins",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderKey = table.Column<string>(maxLength: 128, nullable: false), ProviderKey = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true), ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -113,8 +117,8 @@ namespace WebApp.Data.Migrations
name: "AspNetUserRoles", name: "AspNetUserRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
RoleId = table.Column<string>(nullable: false) RoleId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -137,10 +141,10 @@ namespace WebApp.Data.Migrations
name: "AspNetUserTokens", name: "AspNetUserTokens",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false), Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Value = table.Column<string>(nullable: true) Value = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -162,8 +166,7 @@ namespace WebApp.Data.Migrations
name: "RoleNameIndex", name: "RoleNameIndex",
table: "AspNetRoles", table: "AspNetRoles",
column: "NormalizedName", column: "NormalizedName",
unique: true, unique: true);
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId", name: "IX_AspNetUserClaims_UserId",
@@ -189,10 +192,10 @@ namespace WebApp.Data.Migrations
name: "UserNameIndex", name: "UserNameIndex",
table: "AspNetUsers", table: "AspNetUsers",
column: "NormalizedUserName", column: "NormalizedUserName",
unique: true, unique: true);
filter: "[NormalizedUserName] IS NOT NULL");
} }
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(

View File

@@ -1,12 +1,14 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using WebApp.Data; using WebApp.Data;
namespace WebApp.Data.Migrations #nullable disable
namespace WebApp.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot partial class ApplicationDbContextModelSnapshot : ModelSnapshot
@@ -15,208 +17,209 @@ namespace WebApp.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 63);
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.IsUnique() .IsUnique()
.HasName("RoleNameIndex") .HasDatabaseName("RoleNameIndex");
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("integer");
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd") b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("PasswordHash") b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed") b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<bool>("TwoFactorEnabled") b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
.HasName("EmailIndex"); .HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName") b.HasIndex("NormalizedUserName")
.IsUnique() .IsUnique()
.HasName("UserNameIndex") .HasDatabaseName("UserNameIndex");
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers"); b.ToTable("AspNetUsers", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("integer");
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("nvarchar(450)"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>

View File

@@ -7,7 +7,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString)); options.UseNpgsql(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)

View File

@@ -1,18 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebApp-718c04e4-1a0c-4a69-ab9c-4db84c77bab1</UserSecretsId> <UserSecretsId>aspnet-WebApp-718c04e4-1a0c-4a69-ab9c-4db84c77bab1</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,12 +0,0 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApp-718c04e4-1a0c-4a69-ab9c-4db84c77bab1;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}