diff --git a/Infrastructure/Context/ScriptoriumDbContext.cs b/Infrastructure/Context/ScriptoriumDbContext.cs new file mode 100644 index 0000000..b8d51b2 --- /dev/null +++ b/Infrastructure/Context/ScriptoriumDbContext.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using Infrastructure.Contexts; +using Microsoft.EntityFrameworkCore; +using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal; + +namespace Infrastructure.Context; + +public partial class ScriptoriumDbContext : DbContext +{ + public ScriptoriumDbContext() + { + } + + public ScriptoriumDbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Annotations { get; set; } + + public virtual DbSet Encyclopedia { get; set; } + + public virtual DbSet Scribes { get; set; } + + public virtual DbSet Themes { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder + .UseCollation("utf8mb4_uca1400_ai_ci") + .HasCharSet("utf8mb4"); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.id).HasName("PRIMARY"); + + entity.ToTable("Annotation"); + + entity.HasIndex(e => e.encyclopediaId, "Annotation_Encyclopedia_id_fk"); + + entity.HasIndex(e => e.themeId, "Annotation_Theme_Id_fk"); + + entity.Property(e => e.id).HasColumnType("int(11)"); + entity.Property(e => e.contentUrl) + .HasMaxLength(255) + .HasDefaultValueSql("'notImplemented.md'"); + entity.Property(e => e.encyclopediaId).HasColumnType("int(11)"); + entity.Property(e => e.endPage).HasColumnType("int(11)"); + entity.Property(e => e.startPage).HasColumnType("int(11)"); + entity.Property(e => e.tags) + .HasMaxLength(50) + .HasDefaultValueSql("''"); + entity.Property(e => e.themeId).HasColumnType("int(11)"); + entity.Property(e => e.title).HasMaxLength(255); + + entity.HasOne(d => d.encyclopedia).WithMany(p => p.Annotations) + .HasForeignKey(d => d.encyclopediaId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("Annotation_Encyclopedia_id_fk"); + + entity.HasOne(d => d.theme).WithMany(p => p.Annotations) + .HasForeignKey(d => d.themeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("Annotation_Theme_Id_fk"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.id).HasName("PRIMARY"); + + entity.HasIndex(e => e.scribeId, "Encyclopedia_Scribe_id_fk"); + + entity.Property(e => e.id).HasColumnType("int(11)"); + entity.Property(e => e.scribeId).HasMaxLength(36); + entity.Property(e => e.title).HasMaxLength(50); + + entity.HasOne(d => d.scribe).WithMany(p => p.Encyclopedia) + .HasForeignKey(d => d.scribeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("Encyclopedia_Scribe_id_fk"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.id).HasName("PRIMARY"); + + entity.ToTable("Scribe"); + + entity.HasIndex(e => e.username, "Scribe_username_uk").IsUnique(); + + entity.Property(e => e.id).HasMaxLength(36); + entity.Property(e => e.username).HasMaxLength(50); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.id).HasName("PRIMARY"); + + entity.ToTable("Theme"); + + entity.HasIndex(e => e.name, "Theme_name_uk").IsUnique(); + + entity.Property(e => e.id).HasColumnType("int(11)"); + entity.Property(e => e.folder).HasMaxLength(50); + entity.Property(e => e.name).HasMaxLength(50); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/Infrastructure/Contexts/Annotation.cs b/Infrastructure/Contexts/Annotation.cs new file mode 100644 index 0000000..2593c1d --- /dev/null +++ b/Infrastructure/Contexts/Annotation.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Infrastructure.Contexts; + +public partial class Annotation +{ + public int id { get; set; } + + public string title { get; set; } = null!; + + public int startPage { get; set; } + + public int endPage { get; set; } + + public string contentUrl { get; set; } = null!; + + public string tags { get; set; } = null!; + + public DateOnly date { get; set; } + + public int themeId { get; set; } + + public int encyclopediaId { get; set; } + + public virtual Encyclopedium encyclopedia { get; set; } = null!; + + public virtual Theme theme { get; set; } = null!; +} diff --git a/Infrastructure/Contexts/Encyclopedium.cs b/Infrastructure/Contexts/Encyclopedium.cs new file mode 100644 index 0000000..1927395 --- /dev/null +++ b/Infrastructure/Contexts/Encyclopedium.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Infrastructure.Contexts; + +public partial class Encyclopedium +{ + public int id { get; set; } + + public string title { get; set; } = null!; + + public string scribeId { get; set; } = null!; + + public virtual ICollection Annotations { get; set; } = new List(); + + public virtual Scribe scribe { get; set; } = null!; +} diff --git a/Infrastructure/Contexts/Scribe.cs b/Infrastructure/Contexts/Scribe.cs new file mode 100644 index 0000000..3b498e7 --- /dev/null +++ b/Infrastructure/Contexts/Scribe.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace Infrastructure.Contexts; + +public partial class Scribe +{ + public string id { get; set; } = null!; + + public string username { get; set; } = null!; + + public virtual ICollection Encyclopedia { get; set; } = new List(); +} diff --git a/Infrastructure/Contexts/Theme.cs b/Infrastructure/Contexts/Theme.cs new file mode 100644 index 0000000..903701f --- /dev/null +++ b/Infrastructure/Contexts/Theme.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Infrastructure.Contexts; + +public partial class Theme +{ + public int id { get; set; } + + public string name { get; set; } = null!; + + public string? folder { get; set; } + + public virtual ICollection Annotations { get; set; } = new List(); +} diff --git a/Infrastructure/DependencyInjection.cs b/Infrastructure/DependencyInjection.cs index f8592ef..8c45cc0 100644 --- a/Infrastructure/DependencyInjection.cs +++ b/Infrastructure/DependencyInjection.cs @@ -1,3 +1,4 @@ +using Infrastructure.Context; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -8,6 +9,9 @@ public static class DependencyInjection { public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) { + string? serverConnectionString = configuration.GetConnectionString("ScriptoriumDatabase"); + services.AddDbContext(options => + options.UseMySql(serverConnectionString, ServerVersion.AutoDetect(serverConnectionString))); return services; } } \ No newline at end of file diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index 4015b5f..a5475b4 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -8,6 +8,16 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Infrastructure/Migrations/20251211061844_Initial.Designer.cs b/Infrastructure/Migrations/20251211061844_Initial.Designer.cs new file mode 100644 index 0000000..0738edf --- /dev/null +++ b/Infrastructure/Migrations/20251211061844_Initial.Designer.cs @@ -0,0 +1,201 @@ +// +using System; +using Infrastructure.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Infrastructure.Migrations +{ + [DbContext(typeof(ScriptoriumDbContext))] + [Migration("20251211061844_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("utf8mb4_uca1400_ai_ci") + .HasAnnotation("ProductVersion", "9.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.HasCharSet(modelBuilder, "utf8mb4"); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Infrastructure.Contexts.Annotation", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("contentUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasDefaultValueSql("'notImplemented.md'"); + + b.Property("date") + .HasColumnType("date"); + + b.Property("encyclopediaId") + .HasColumnType("int(11)"); + + b.Property("endPage") + .HasColumnType("int(11)"); + + b.Property("startPage") + .HasColumnType("int(11)"); + + b.Property("tags") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValueSql("''"); + + b.Property("themeId") + .HasColumnType("int(11)"); + + b.Property("title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "encyclopediaId" }, "Annotation_Encyclopedia_id_fk"); + + b.HasIndex(new[] { "themeId" }, "Annotation_Theme_Id_fk"); + + b.ToTable("Annotation", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("scribeId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "scribeId" }, "Encyclopedia_Scribe_id_fk"); + + b.ToTable("Encyclopedia"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Scribe", b => + { + b.Property("id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("username") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "username" }, "Scribe_username_uk") + .IsUnique(); + + b.ToTable("Scribe", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Theme", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("folder") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "name" }, "Theme_name_uk") + .IsUnique(); + + b.ToTable("Theme", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Annotation", b => + { + b.HasOne("Infrastructure.Contexts.Encyclopedium", "encyclopedia") + .WithMany("Annotations") + .HasForeignKey("encyclopediaId") + .IsRequired() + .HasConstraintName("Annotation_Encyclopedia_id_fk"); + + b.HasOne("Infrastructure.Contexts.Theme", "theme") + .WithMany("Annotations") + .HasForeignKey("themeId") + .IsRequired() + .HasConstraintName("Annotation_Theme_Id_fk"); + + b.Navigation("encyclopedia"); + + b.Navigation("theme"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.HasOne("Infrastructure.Contexts.Scribe", "scribe") + .WithMany("Encyclopedia") + .HasForeignKey("scribeId") + .IsRequired() + .HasConstraintName("Encyclopedia_Scribe_id_fk"); + + b.Navigation("scribe"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.Navigation("Annotations"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Scribe", b => + { + b.Navigation("Encyclopedia"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Theme", b => + { + b.Navigation("Annotations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Migrations/20251211061844_Initial.cs b/Infrastructure/Migrations/20251211061844_Initial.cs new file mode 100644 index 0000000..cc92d52 --- /dev/null +++ b/Infrastructure/Migrations/20251211061844_Initial.cs @@ -0,0 +1,154 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Infrastructure.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Scribe", + columns: table => new + { + id = table.Column(type: "varchar(36)", maxLength: 36, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + username = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PRIMARY", x => x.id); + }) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:Collation", "utf8mb4_uca1400_ai_ci"); + + migrationBuilder.CreateTable( + name: "Theme", + columns: table => new + { + id = table.Column(type: "int(11)", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + name = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + folder = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PRIMARY", x => x.id); + }) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:Collation", "utf8mb4_uca1400_ai_ci"); + + migrationBuilder.CreateTable( + name: "Encyclopedia", + columns: table => new + { + id = table.Column(type: "int(11)", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + title = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + scribeId = table.Column(type: "varchar(36)", maxLength: 36, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PRIMARY", x => x.id); + table.ForeignKey( + name: "Encyclopedia_Scribe_id_fk", + column: x => x.scribeId, + principalTable: "Scribe", + principalColumn: "id"); + }) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:Collation", "utf8mb4_uca1400_ai_ci"); + + migrationBuilder.CreateTable( + name: "Annotation", + columns: table => new + { + id = table.Column(type: "int(11)", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + title = table.Column(type: "varchar(255)", maxLength: 255, nullable: false, collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + startPage = table.Column(type: "int(11)", nullable: false), + endPage = table.Column(type: "int(11)", nullable: false), + contentUrl = table.Column(type: "varchar(255)", maxLength: 255, nullable: false, defaultValueSql: "'notImplemented.md'", collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + tags = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, defaultValueSql: "''", collation: "utf8mb4_uca1400_ai_ci") + .Annotation("MySql:CharSet", "utf8mb4"), + date = table.Column(type: "date", nullable: false), + themeId = table.Column(type: "int(11)", nullable: false), + encyclopediaId = table.Column(type: "int(11)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PRIMARY", x => x.id); + table.ForeignKey( + name: "Annotation_Encyclopedia_id_fk", + column: x => x.encyclopediaId, + principalTable: "Encyclopedia", + principalColumn: "id"); + table.ForeignKey( + name: "Annotation_Theme_Id_fk", + column: x => x.themeId, + principalTable: "Theme", + principalColumn: "id"); + }) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:Collation", "utf8mb4_uca1400_ai_ci"); + + migrationBuilder.CreateIndex( + name: "Annotation_Encyclopedia_id_fk", + table: "Annotation", + column: "encyclopediaId"); + + migrationBuilder.CreateIndex( + name: "Annotation_Theme_Id_fk", + table: "Annotation", + column: "themeId"); + + migrationBuilder.CreateIndex( + name: "Encyclopedia_Scribe_id_fk", + table: "Encyclopedia", + column: "scribeId"); + + migrationBuilder.CreateIndex( + name: "Scribe_username_uk", + table: "Scribe", + column: "username", + unique: true); + + migrationBuilder.CreateIndex( + name: "Theme_name_uk", + table: "Theme", + column: "name", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Annotation"); + + migrationBuilder.DropTable( + name: "Encyclopedia"); + + migrationBuilder.DropTable( + name: "Theme"); + + migrationBuilder.DropTable( + name: "Scribe"); + } + } +} diff --git a/Infrastructure/Migrations/ScriptoriumDbContextModelSnapshot.cs b/Infrastructure/Migrations/ScriptoriumDbContextModelSnapshot.cs new file mode 100644 index 0000000..cda5f37 --- /dev/null +++ b/Infrastructure/Migrations/ScriptoriumDbContextModelSnapshot.cs @@ -0,0 +1,198 @@ +// +using System; +using Infrastructure.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Infrastructure.Migrations +{ + [DbContext(typeof(ScriptoriumDbContext))] + partial class ScriptoriumDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("utf8mb4_uca1400_ai_ci") + .HasAnnotation("ProductVersion", "9.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.HasCharSet(modelBuilder, "utf8mb4"); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Infrastructure.Contexts.Annotation", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("contentUrl") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasDefaultValueSql("'notImplemented.md'"); + + b.Property("date") + .HasColumnType("date"); + + b.Property("encyclopediaId") + .HasColumnType("int(11)"); + + b.Property("endPage") + .HasColumnType("int(11)"); + + b.Property("startPage") + .HasColumnType("int(11)"); + + b.Property("tags") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValueSql("''"); + + b.Property("themeId") + .HasColumnType("int(11)"); + + b.Property("title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "encyclopediaId" }, "Annotation_Encyclopedia_id_fk"); + + b.HasIndex(new[] { "themeId" }, "Annotation_Theme_Id_fk"); + + b.ToTable("Annotation", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("scribeId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "scribeId" }, "Encyclopedia_Scribe_id_fk"); + + b.ToTable("Encyclopedia"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Scribe", b => + { + b.Property("id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("username") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "username" }, "Scribe_username_uk") + .IsUnique(); + + b.ToTable("Scribe", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Theme", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int(11)"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("id")); + + b.Property("folder") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("id") + .HasName("PRIMARY"); + + b.HasIndex(new[] { "name" }, "Theme_name_uk") + .IsUnique(); + + b.ToTable("Theme", (string)null); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Annotation", b => + { + b.HasOne("Infrastructure.Contexts.Encyclopedium", "encyclopedia") + .WithMany("Annotations") + .HasForeignKey("encyclopediaId") + .IsRequired() + .HasConstraintName("Annotation_Encyclopedia_id_fk"); + + b.HasOne("Infrastructure.Contexts.Theme", "theme") + .WithMany("Annotations") + .HasForeignKey("themeId") + .IsRequired() + .HasConstraintName("Annotation_Theme_Id_fk"); + + b.Navigation("encyclopedia"); + + b.Navigation("theme"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.HasOne("Infrastructure.Contexts.Scribe", "scribe") + .WithMany("Encyclopedia") + .HasForeignKey("scribeId") + .IsRequired() + .HasConstraintName("Encyclopedia_Scribe_id_fk"); + + b.Navigation("scribe"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Encyclopedium", b => + { + b.Navigation("Annotations"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Scribe", b => + { + b.Navigation("Encyclopedia"); + }); + + modelBuilder.Entity("Infrastructure.Contexts.Theme", b => + { + b.Navigation("Annotations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WebApi/WebApi.csproj b/WebApi/WebApi.csproj index 89ee4ec..e096ff5 100644 --- a/WebApi/WebApi.csproj +++ b/WebApi/WebApi.csproj @@ -12,6 +12,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +