Verzeichnisse umgeräumt

This commit is contained in:
2023-04-13 09:24:40 +02:00
parent 1d649d14cb
commit 047e036442
99 changed files with 8 additions and 1930 deletions

View File

@@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" /> <ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" /> <ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -11,6 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" /> <ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -1,217 +0,0 @@
// <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

@@ -1,146 +0,0 @@
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

@@ -1,233 +0,0 @@
// <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("20230329145638_AuftraggeberAddedToProject")]
partial class AuftraggeberAddedToProject
{
/// <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<int>("AuftraggeberId")
.HasColumnType("integer");
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.HasIndex("AuftraggeberId");
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.Projekt", b =>
{
b.HasOne("Shared.Domain.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Auftraggeber");
});
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

@@ -1,50 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class AuftraggeberAddedToProject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "AuftraggeberId",
table: "Projekte",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_Projekte_AuftraggeberId",
table: "Projekte",
column: "AuftraggeberId");
migrationBuilder.AddForeignKey(
name: "FK_Projekte_Auftraggebers_AuftraggeberId",
table: "Projekte",
column: "AuftraggeberId",
principalTable: "Auftraggebers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projekte_Auftraggebers_AuftraggeberId",
table: "Projekte");
migrationBuilder.DropIndex(
name: "IX_Projekte_AuftraggeberId",
table: "Projekte");
migrationBuilder.DropColumn(
name: "AuftraggeberId",
table: "Projekte");
}
}
}

View File

@@ -1,220 +0,0 @@
// <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("20230330100444_AddedNullValue")]
partial class AddedNullValue
{
/// <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")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.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")
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.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<int>("AuftraggeberId")
.HasColumnType("integer");
b.Property<string>("Erstelldatum")
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Projektname")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
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")
.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.Projekt", b =>
{
b.HasOne("Shared.Domain.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Auftraggeber");
});
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

@@ -1,252 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class AddedNullValue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Schaechte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Projektname",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Erstelldatum",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Kanaele",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Material",
table: "Kanaele",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Telefonnummer",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Postleitzahl",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ansprechpartner",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Schaechte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Projektname",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Erstelldatum",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Kanaele",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Material",
table: "Kanaele",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Telefonnummer",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Postleitzahl",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ansprechpartner",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}

View File

@@ -1,222 +0,0 @@
// <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("20230331095322_SchachtRefProject")]
partial class SchachtRefProject
{
/// <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")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.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")
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.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<int>("AuftraggeberId")
.HasColumnType("integer");
b.Property<string>("Erstelldatum")
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Projektname")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
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")
.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.Projekt", b =>
{
b.HasOne("Shared.Domain.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Auftraggeber");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.HasOne("Shared.Domain.Projekt", "Projekt")
.WithMany("Schaechte")
.HasForeignKey("ProjektId");
b.Navigation("Projekt");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Navigation("Kanaele");
b.Navigation("Schaechte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class SchachtRefProject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -1,219 +0,0 @@
// <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")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Auftraggebers", (string)null);
});
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")
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.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", (string)null);
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AuftraggeberId")
.HasColumnType("integer");
b.Property<string>("Erstelldatum")
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Projektname")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
b.ToTable("Projekte", (string)null);
});
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")
.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", (string)null);
});
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.Projekt", b =>
{
b.HasOne("Shared.Domain.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Auftraggeber");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.HasOne("Shared.Domain.Projekt", "Projekt")
.WithMany("Schaechte")
.HasForeignKey("ProjektId");
b.Navigation("Projekt");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Navigation("Kanaele");
b.Navigation("Schaechte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,56 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.EntityFramework.Services.Common
{
class NonQueryDataService<T> where T: DBObject
{
private readonly SewerStammGenDbContextFactory _contextFactory;
public NonQueryDataService(SewerStammGenDbContextFactory contextFactory)
{
_contextFactory = contextFactory;
}
public async Task<T> Create(T entity)
{
using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
EntityEntry<T> createdEntity = await context.Set<T>().AddAsync(entity);
await context.SaveChangesAsync();
return createdEntity.Entity;
}
public T CreateNonAsync(T entity)
{
using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
EntityEntry<T> createdEntity = context.Set<T>().Add(entity);
context.SaveChanges();
return createdEntity.Entity;
}
public async Task<bool> Delete(int id)
{
using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
T? entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id);
if (entity == null) return false;
context.Set<T>().Remove(entity);
await context.SaveChangesAsync();
return true;
}
public async Task<T> Update(int id, T entity)
{
using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
entity.Id = id;
context.Set<T>().Update(entity);
await context.SaveChangesAsync();
return entity;
}
}
}

View File

@@ -1,67 +0,0 @@
using Microsoft.EntityFrameworkCore;
using SewerStammGen.EntityFramework.Services.Common;
using Shared.Contracts;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.EntityFramework.Services
{
public class GenericDataService<T> : IDataService<T> where T : DBObject
{
private readonly SewerStammGenDbContextFactory _contextFactory;
private readonly NonQueryDataService<T> _nonQueryDataService;
public GenericDataService(SewerStammGenDbContextFactory contextFactory)
{
_contextFactory = contextFactory;
_nonQueryDataService = new NonQueryDataService<T>(contextFactory);
}
public async Task<T> Create(T entity)
{
return await _nonQueryDataService.Create(entity);
}
public T CreateNonAsync(T entity)
{
return _nonQueryDataService.CreateNonAsync(entity);
}
public async Task<bool> Delete(int id)
{
return await (_nonQueryDataService.Delete(id));
}
public async Task<T> Get(int id)
{
using(SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
T entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id);
return entity;
}
}
public async Task<IEnumerable<T>> GetAll()
{
using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
IEnumerable<T> entities = await context.Set<T>().ToListAsync();
return entities;
}
}
public async Task<T> Update(int id, T entity)
{
return await _nonQueryDataService.Update(id, entity);
}
T IDataService<T>.CreateNonAsync(T entity)
{
return _nonQueryDataService.CreateNonAsync(entity);
}
}
}

View File

@@ -1,70 +0,0 @@
using Microsoft.EntityFrameworkCore;
using SewerStammGen.EntityFramework.Services.Common;
using SewerStammGen.Shared.Contracts;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.EntityFramework.Services
{
public class HaltungDataService : IHaltungDataService
{
private readonly SewerStammGenDbContextFactory _contextFactory;
private readonly NonQueryDataService<Kanal> _nonQueryDataService;
public HaltungDataService(SewerStammGenDbContextFactory contextFactory)
{
_contextFactory = contextFactory;
_nonQueryDataService = new NonQueryDataService<Kanal>(contextFactory);
}
public async Task<Kanal> Create(Kanal entity)
{
return await _nonQueryDataService.Create(entity);
}
public Kanal CreateNonAsync(Kanal entity)
{
throw new NotImplementedException();
}
public Task<bool> Delete(int id)
{
throw new NotImplementedException();
}
public async Task<Kanal> Get(int id)
{
using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
Kanal entity = await context.Set<Kanal>()
.Include("StartSchacht")
.Include("EndSchacht")
.Include("Projekt")
.FirstOrDefaultAsync((e) => e.Id == id);
return entity;
}
}
public async Task<IEnumerable<Kanal>> GetAll(int projektID)
{
using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
IEnumerable<Kanal> entities = await context.Set<Kanal>().Where(x => x.Projekt.Id.Equals(projektID)).ToListAsync();
return entities;
}
}
public Task<IEnumerable<Kanal>> GetAll()
{
throw new NotImplementedException();
}
public async Task<Kanal> Update(int id, Kanal entity)
{
return await _nonQueryDataService.Update(id, entity);
}
}
}

View File

@@ -1,72 +0,0 @@
using Microsoft.EntityFrameworkCore;
using SewerStammGen.EntityFramework.Services.Common;
using SewerStammGen.Shared.Contracts;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.EntityFramework.Services
{
public class SchachtDataService : ISchachtDataService
{
private readonly SewerStammGenDbContextFactory _contextFactory;
private readonly NonQueryDataService<Schacht> _nonQueryDataService;
public SchachtDataService(SewerStammGenDbContextFactory contextFactory)
{
_contextFactory = contextFactory;
_nonQueryDataService = new NonQueryDataService<Schacht>(contextFactory);
}
public async Task<Schacht> Create(Schacht entity)
{
return await _nonQueryDataService.Create(entity);
}
public Schacht CreateNonAsync(Schacht entity)
{
throw new NotImplementedException();
}
public Task<bool> Delete(int id)
{
throw new NotImplementedException();
}
public Task<Schacht> Get(int id)
{
throw new NotImplementedException();
}
public async Task<IEnumerable<Schacht>> GetAll(int projektID)
{
using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
IEnumerable<Schacht> entities = await context.Set<Schacht>().Where(x => x.Projekt.Id.Equals(projektID)).ToListAsync();
return entities;
}
}
public Task<IEnumerable<Schacht>> GetAll()
{
throw new NotImplementedException();
}
public async Task<Schacht> GetSchachtByNameAndProjekt(string name, int projektID)
{
using(SewerStammGenDbContext context = _contextFactory.CreateDbContext())
{
Schacht entity = await context.Set<Schacht>().Where(x => x.Projekt.Id.Equals(projektID) && x.Objektbezeichnung.Equals(name)).FirstOrDefaultAsync();
return entity;
}
}
public async Task<Schacht> Update(int id, Schacht entity)
{
return await _nonQueryDataService.Update(id, entity);
}
}
}

View File

@@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,20 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Shared.Domain;
namespace SewerStammGen.EntityFramework
{
public class SewerStammGenDbContext : DbContext
{
public SewerStammGenDbContext(DbContextOptions options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
public DbSet<Schacht>? Schaechte { get; set; }
public DbSet<Projekt>? Projekte { get; set; }
public DbSet<Kanal>? Kanaele { get; set; }
public DbSet<Auftraggeber>? Auftraggebers { get; set; }
}
}

View File

@@ -1,37 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.EntityFramework
{
public class SewerStammGenDbContextFactory : IDesignTimeDbContextFactory<SewerStammGenDbContext>
{
private readonly Action<DbContextOptionsBuilder> _configureDbContext;
public SewerStammGenDbContextFactory() { }
public SewerStammGenDbContextFactory(Action<DbContextOptionsBuilder> configureDbContext)
{
_configureDbContext = configureDbContext;
}
public SewerStammGenDbContext CreateDbContext()
{
DbContextOptionsBuilder<SewerStammGenDbContext>? options = new();
_configureDbContext( options );
return new SewerStammGenDbContext(options.Options);
}
public SewerStammGenDbContext CreateDbContext(string[] args)
{
var options = new DbContextOptionsBuilder<SewerStammGenDbContext>();
options.UseNpgsql("Host = localhost; Database = SewerGen; Username = SewerGen; Password = SewerGen");
SewerStammGenDbContext result = new(options.Options);
return result;
}
}
}

View File

@@ -7,7 +7,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Services\" /> <Compile Remove="Services\**" />
<EmbeddedResource Remove="Services\**" />
<None Remove="Services\**" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -20,7 +20,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" /> <ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" /> <ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453 VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.WPF", "SewerStammGen\SewerStammGen.WPF.csproj", "{7052AE7B-9E3C-4C04-9756-7488D21512C1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.WPF", "SewerStammGen.WPF\SewerStammGen.WPF.csproj", "{7052AE7B-9E3C-4C04-9756-7488D21512C1}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.Shared", "Shared\SewerStammGen.Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.Shared", "SewerStammGen.Shared\SewerStammGen.Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen.DAL", "SewerStammGen.DAL\SewerStammGen.DAL.csproj", "{7D983D7C-84C2-4FD8-B2CE-B13529036CB5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen.DAL", "SewerStammGen.DAL\SewerStammGen.DAL.csproj", "{7D983D7C-84C2-4FD8-B2CE-B13529036CB5}"
EndProject EndProject