Entityframework hinzugefügt

This commit is contained in:
2023-03-28 09:20:45 +02:00
parent 5b2ed72fe3
commit a1f5b8437c
18 changed files with 910 additions and 8 deletions

View File

@@ -0,0 +1,217 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SewerStammGen.EntityFramework;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
[DbContext(typeof(SewerStammGenDbContext))]
[Migration("20230328071830_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Shared.Domain.Auftraggeber", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Ansprechpartner")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Auftraggebers");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DN")
.HasColumnType("integer");
b.Property<int?>("EndSchachtId")
.HasColumnType("integer");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("Haltungslaenge")
.HasColumnType("numeric");
b.Property<string>("Material")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<int?>("StartSchachtId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("EndSchachtId");
b.HasIndex("ProjektId");
b.HasIndex("StartSchachtId");
b.ToTable("Kanaele");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Erstelldatum")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Projektname")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Projekte");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<decimal>("DeckelHoehe")
.HasColumnType("decimal(18,4)");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("HochWert")
.HasColumnType("decimal(18,4)");
b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<decimal>("RechtsWert")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("SohlHoehe")
.HasColumnType("decimal(18,4)");
b.HasKey("Id");
b.HasIndex("ProjektId");
b.ToTable("Schaechte");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.HasOne("Shared.Domain.Schacht", "EndSchacht")
.WithMany()
.HasForeignKey("EndSchachtId");
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Kanaele")
.HasForeignKey("ProjektId");
b.HasOne("Shared.Domain.Schacht", "StartSchacht")
.WithMany()
.HasForeignKey("StartSchachtId");
b.Navigation("EndSchacht");
b.Navigation("StartSchacht");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Schaechte")
.HasForeignKey("ProjektId");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Navigation("Kanaele");
b.Navigation("Schaechte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,146 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Auftraggebers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Strasse = table.Column<string>(type: "text", nullable: false),
Ort = table.Column<string>(type: "text", nullable: false),
Postleitzahl = table.Column<string>(type: "text", nullable: false),
Ansprechpartner = table.Column<string>(type: "text", nullable: false),
Telefonnummer = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Auftraggebers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Projekte",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Projektname = table.Column<string>(type: "text", nullable: false),
Erstelldatum = table.Column<string>(type: "text", nullable: false),
Strasse = table.Column<string>(type: "text", nullable: false),
Ort = table.Column<string>(type: "text", nullable: false),
ExportType = table.Column<int>(type: "integer", nullable: false),
Kodierungssystem = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Projekte", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Schaechte",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Objektbezeichnung = table.Column<string>(type: "text", nullable: false),
RechtsWert = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
HochWert = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
SohlHoehe = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
DeckelHoehe = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
Entwaesserung = table.Column<int>(type: "integer", nullable: false),
ProjektId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Schaechte", x => x.Id);
table.ForeignKey(
name: "FK_Schaechte_Projekte_ProjektId",
column: x => x.ProjektId,
principalTable: "Projekte",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Kanaele",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Objektbezeichnung = table.Column<string>(type: "text", nullable: false),
StartSchachtId = table.Column<int>(type: "integer", nullable: true),
EndSchachtId = table.Column<int>(type: "integer", nullable: true),
DN = table.Column<int>(type: "integer", nullable: false),
Material = table.Column<string>(type: "text", nullable: false),
Haltungslaenge = table.Column<decimal>(type: "numeric", nullable: false),
Entwaesserung = table.Column<int>(type: "integer", nullable: false),
ProjektId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Kanaele", x => x.Id);
table.ForeignKey(
name: "FK_Kanaele_Projekte_ProjektId",
column: x => x.ProjektId,
principalTable: "Projekte",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Kanaele_Schaechte_EndSchachtId",
column: x => x.EndSchachtId,
principalTable: "Schaechte",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Kanaele_Schaechte_StartSchachtId",
column: x => x.StartSchachtId,
principalTable: "Schaechte",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Kanaele_EndSchachtId",
table: "Kanaele",
column: "EndSchachtId");
migrationBuilder.CreateIndex(
name: "IX_Kanaele_ProjektId",
table: "Kanaele",
column: "ProjektId");
migrationBuilder.CreateIndex(
name: "IX_Kanaele_StartSchachtId",
table: "Kanaele",
column: "StartSchachtId");
migrationBuilder.CreateIndex(
name: "IX_Schaechte_ProjektId",
table: "Schaechte",
column: "ProjektId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Auftraggebers");
migrationBuilder.DropTable(
name: "Kanaele");
migrationBuilder.DropTable(
name: "Schaechte");
migrationBuilder.DropTable(
name: "Projekte");
}
}
}

View File

@@ -0,0 +1,214 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SewerStammGen.EntityFramework;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
[DbContext(typeof(SewerStammGenDbContext))]
partial class SewerStammGenDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Shared.Domain.Auftraggeber", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Ansprechpartner")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Auftraggebers");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DN")
.HasColumnType("integer");
b.Property<int?>("EndSchachtId")
.HasColumnType("integer");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("Haltungslaenge")
.HasColumnType("numeric");
b.Property<string>("Material")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<int?>("StartSchachtId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("EndSchachtId");
b.HasIndex("ProjektId");
b.HasIndex("StartSchachtId");
b.ToTable("Kanaele");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Erstelldatum")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Projektname")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Projekte");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<decimal>("DeckelHoehe")
.HasColumnType("decimal(18,4)");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("HochWert")
.HasColumnType("decimal(18,4)");
b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<decimal>("RechtsWert")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("SohlHoehe")
.HasColumnType("decimal(18,4)");
b.HasKey("Id");
b.HasIndex("ProjektId");
b.ToTable("Schaechte");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.HasOne("Shared.Domain.Schacht", "EndSchacht")
.WithMany()
.HasForeignKey("EndSchachtId");
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Kanaele")
.HasForeignKey("ProjektId");
b.HasOne("Shared.Domain.Schacht", "StartSchacht")
.WithMany()
.HasForeignKey("StartSchachtId");
b.Navigation("EndSchacht");
b.Navigation("StartSchacht");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Schaechte")
.HasForeignKey("ProjektId");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Navigation("Kanaele");
b.Navigation("Schaechte");
});
#pragma warning restore 612, 618
}
}
}