diff --git a/Blog/Data/Migrations/20221108003635_InitialCreate.Designer.cs b/Blog/Data/Migrations/20221108003635_InitialCreate.Designer.cs
new file mode 100644
index 0000000..ec9f14b
--- /dev/null
+++ b/Blog/Data/Migrations/20221108003635_InitialCreate.Designer.cs
@@ -0,0 +1,303 @@
+//
+using System;
+using Blog.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Blog.Data.Migrations
+{
+ [DbContext(typeof(BlogDataContext))]
+ [Migration("20221108003635_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Blog.Models.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("NVARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Category_Slug")
+ .IsUnique();
+
+ b.ToTable("Category", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Post", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AuthorId")
+ .HasColumnType("int");
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CategoryId")
+ .HasColumnType("int");
+
+ b.Property("CreateDate")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("SMALLDATETIME")
+ .HasDefaultValueSql("GETDATE()");
+
+ b.Property("LastUpdateDate")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("SMALLDATETIME")
+ .HasDefaultValueSql("GETDATE()");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Summary")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(160)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.HasIndex("CategoryId");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Post_Slug")
+ .IsUnique();
+
+ b.ToTable("Post", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Role", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Role_Slug")
+ .IsUnique();
+
+ b.ToTable("Role", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Tag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Tag_Slug")
+ .IsUnique();
+
+ b.ToTable("Tag", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Image")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("NVARCHAR");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_User_Slug")
+ .IsUnique();
+
+ b.ToTable("User", (string)null);
+ });
+
+ modelBuilder.Entity("PostTag", b =>
+ {
+ b.Property("PostId")
+ .HasColumnType("int");
+
+ b.Property("TagId")
+ .HasColumnType("int");
+
+ b.HasKey("PostId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("PostTag");
+ });
+
+ modelBuilder.Entity("UserRole", b =>
+ {
+ b.Property("RoleId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("RoleId", "UserId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserRole");
+ });
+
+ modelBuilder.Entity("Blog.Models.Post", b =>
+ {
+ b.HasOne("Blog.Models.User", "Author")
+ .WithMany("Posts")
+ .HasForeignKey("AuthorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_Post_Author");
+
+ b.HasOne("Blog.Models.Category", "Category")
+ .WithMany("Posts")
+ .HasForeignKey("CategoryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_Post_Category");
+
+ b.Navigation("Author");
+
+ b.Navigation("Category");
+ });
+
+ modelBuilder.Entity("PostTag", b =>
+ {
+ b.HasOne("Blog.Models.Post", null)
+ .WithMany()
+ .HasForeignKey("PostId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_PostTag_PostId");
+
+ b.HasOne("Blog.Models.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_PostTag_TagId");
+ });
+
+ modelBuilder.Entity("UserRole", b =>
+ {
+ b.HasOne("Blog.Models.Role", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_UserRole_RoleId");
+
+ b.HasOne("Blog.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_UserRole_UserId");
+ });
+
+ modelBuilder.Entity("Blog.Models.Category", b =>
+ {
+ b.Navigation("Posts");
+ });
+
+ modelBuilder.Entity("Blog.Models.User", b =>
+ {
+ b.Navigation("Posts");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Blog/Data/Migrations/20221108003635_InitialCreate.cs b/Blog/Data/Migrations/20221108003635_InitialCreate.cs
new file mode 100644
index 0000000..4609860
--- /dev/null
+++ b/Blog/Data/Migrations/20221108003635_InitialCreate.cs
@@ -0,0 +1,230 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Blog.Data.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Category",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Slug = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false),
+ Title = table.Column(type: "NVARCHAR(80)", maxLength: 80, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Category", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Role",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false),
+ Slug = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Role", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Tag",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false),
+ Slug = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Tag", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "User",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Bio = table.Column(type: "TEXT", nullable: false),
+ Email = table.Column(type: "VARCHAR(200)", maxLength: 200, nullable: false),
+ Image = table.Column(type: "VARCHAR(2000)", maxLength: 2000, nullable: false),
+ Name = table.Column(type: "NVARCHAR(80)", maxLength: 80, nullable: false),
+ PasswordHash = table.Column(type: "VARCHAR(255)", maxLength: 255, nullable: false),
+ Slug = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_User", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Post",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ AuthorId = table.Column(type: "int", nullable: false),
+ Body = table.Column(type: "TEXT", nullable: false),
+ CategoryId = table.Column(type: "int", nullable: false),
+ CreateDate = table.Column(type: "SMALLDATETIME", nullable: false, defaultValueSql: "GETDATE()"),
+ LastUpdateDate = table.Column(type: "SMALLDATETIME", nullable: false, defaultValueSql: "GETDATE()"),
+ Slug = table.Column(type: "VARCHAR(80)", maxLength: 80, nullable: false),
+ Summary = table.Column(type: "VARCHAR(255)", maxLength: 255, nullable: false),
+ Title = table.Column(type: "VARCHAR(160)", maxLength: 160, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Post", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Post_Author",
+ column: x => x.AuthorId,
+ principalTable: "User",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Post_Category",
+ column: x => x.CategoryId,
+ principalTable: "Category",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "UserRole",
+ columns: table => new
+ {
+ RoleId = table.Column(type: "int", nullable: false),
+ UserId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_UserRole", x => new { x.RoleId, x.UserId });
+ table.ForeignKey(
+ name: "FK_UserRole_RoleId",
+ column: x => x.RoleId,
+ principalTable: "Role",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_UserRole_UserId",
+ column: x => x.UserId,
+ principalTable: "User",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "PostTag",
+ columns: table => new
+ {
+ PostId = table.Column(type: "int", nullable: false),
+ TagId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_PostTag", x => new { x.PostId, x.TagId });
+ table.ForeignKey(
+ name: "FK_PostTag_PostId",
+ column: x => x.PostId,
+ principalTable: "Post",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_PostTag_TagId",
+ column: x => x.TagId,
+ principalTable: "Tag",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Category_Slug",
+ table: "Category",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Post_AuthorId",
+ table: "Post",
+ column: "AuthorId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Post_CategoryId",
+ table: "Post",
+ column: "CategoryId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Post_Slug",
+ table: "Post",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_PostTag_TagId",
+ table: "PostTag",
+ column: "TagId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Role_Slug",
+ table: "Role",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Tag_Slug",
+ table: "Tag",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_User_Slug",
+ table: "User",
+ column: "Slug",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_UserRole_UserId",
+ table: "UserRole",
+ column: "UserId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "PostTag");
+
+ migrationBuilder.DropTable(
+ name: "UserRole");
+
+ migrationBuilder.DropTable(
+ name: "Post");
+
+ migrationBuilder.DropTable(
+ name: "Tag");
+
+ migrationBuilder.DropTable(
+ name: "Role");
+
+ migrationBuilder.DropTable(
+ name: "User");
+
+ migrationBuilder.DropTable(
+ name: "Category");
+ }
+ }
+}
diff --git a/Blog/Data/Migrations/BlogDataContextModelSnapshot.cs b/Blog/Data/Migrations/BlogDataContextModelSnapshot.cs
new file mode 100644
index 0000000..d3902fb
--- /dev/null
+++ b/Blog/Data/Migrations/BlogDataContextModelSnapshot.cs
@@ -0,0 +1,300 @@
+//
+using System;
+using Blog.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Blog.Data.Migrations
+{
+ [DbContext(typeof(BlogDataContext))]
+ partial class BlogDataContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Blog.Models.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("NVARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Category_Slug")
+ .IsUnique();
+
+ b.ToTable("Category", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Post", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AuthorId")
+ .HasColumnType("int");
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CategoryId")
+ .HasColumnType("int");
+
+ b.Property("CreateDate")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("SMALLDATETIME")
+ .HasDefaultValueSql("GETDATE()");
+
+ b.Property("LastUpdateDate")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("SMALLDATETIME")
+ .HasDefaultValueSql("GETDATE()");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Summary")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(160)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.HasIndex("CategoryId");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Post_Slug")
+ .IsUnique();
+
+ b.ToTable("Post", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Role", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Role_Slug")
+ .IsUnique();
+
+ b.ToTable("Role", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.Tag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_Tag_Slug")
+ .IsUnique();
+
+ b.ToTable("Tag", (string)null);
+ });
+
+ modelBuilder.Entity("Blog.Models.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Image")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("NVARCHAR");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("VARCHAR");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(80)
+ .HasColumnType("VARCHAR");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "Slug" }, "IX_User_Slug")
+ .IsUnique();
+
+ b.ToTable("User", (string)null);
+ });
+
+ modelBuilder.Entity("PostTag", b =>
+ {
+ b.Property("PostId")
+ .HasColumnType("int");
+
+ b.Property("TagId")
+ .HasColumnType("int");
+
+ b.HasKey("PostId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("PostTag");
+ });
+
+ modelBuilder.Entity("UserRole", b =>
+ {
+ b.Property("RoleId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("RoleId", "UserId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserRole");
+ });
+
+ modelBuilder.Entity("Blog.Models.Post", b =>
+ {
+ b.HasOne("Blog.Models.User", "Author")
+ .WithMany("Posts")
+ .HasForeignKey("AuthorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_Post_Author");
+
+ b.HasOne("Blog.Models.Category", "Category")
+ .WithMany("Posts")
+ .HasForeignKey("CategoryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_Post_Category");
+
+ b.Navigation("Author");
+
+ b.Navigation("Category");
+ });
+
+ modelBuilder.Entity("PostTag", b =>
+ {
+ b.HasOne("Blog.Models.Post", null)
+ .WithMany()
+ .HasForeignKey("PostId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_PostTag_PostId");
+
+ b.HasOne("Blog.Models.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_PostTag_TagId");
+ });
+
+ modelBuilder.Entity("UserRole", b =>
+ {
+ b.HasOne("Blog.Models.Role", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_UserRole_RoleId");
+
+ b.HasOne("Blog.Models.User", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired()
+ .HasConstraintName("FK_UserRole_UserId");
+ });
+
+ modelBuilder.Entity("Blog.Models.Category", b =>
+ {
+ b.Navigation("Posts");
+ });
+
+ modelBuilder.Entity("Blog.Models.User", b =>
+ {
+ b.Navigation("Posts");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}