diff --git a/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.Designer.cs b/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.Designer.cs
new file mode 100644
index 0000000..aef6f66
--- /dev/null
+++ b/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.Designer.cs
@@ -0,0 +1,217 @@
+//
+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
+ {
+ ///
+ 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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Ansprechpartner")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Ort")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Postleitzahl")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Strasse")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Telefonnummer")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Auftraggebers");
+ });
+
+ modelBuilder.Entity("Shared.Domain.Kanal", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DN")
+ .HasColumnType("integer");
+
+ b.Property("EndSchachtId")
+ .HasColumnType("integer");
+
+ b.Property("Entwaesserung")
+ .HasColumnType("integer");
+
+ b.Property("Haltungslaenge")
+ .HasColumnType("numeric");
+
+ b.Property("Material")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Objektbezeichnung")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ProjektId")
+ .HasColumnType("integer");
+
+ b.Property("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Erstelldatum")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ExportType")
+ .HasColumnType("integer");
+
+ b.Property("Kodierungssystem")
+ .HasColumnType("integer");
+
+ b.Property("Ort")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Projektname")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Strasse")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Projekte");
+ });
+
+ modelBuilder.Entity("Shared.Domain.Schacht", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DeckelHoehe")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("Entwaesserung")
+ .HasColumnType("integer");
+
+ b.Property("HochWert")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("Objektbezeichnung")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ProjektId")
+ .HasColumnType("integer");
+
+ b.Property("RechtsWert")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("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
+ }
+ }
+}
diff --git a/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.cs b/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.cs
new file mode 100644
index 0000000..f46e15d
--- /dev/null
+++ b/SewerStammGen.EntityFramework/Migrations/20230328071830_InitialCreate.cs
@@ -0,0 +1,146 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace SewerStammGen.EntityFramework.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Auftraggebers",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ Strasse = table.Column(type: "text", nullable: false),
+ Ort = table.Column(type: "text", nullable: false),
+ Postleitzahl = table.Column(type: "text", nullable: false),
+ Ansprechpartner = table.Column(type: "text", nullable: false),
+ Telefonnummer = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Auftraggebers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Projekte",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Projektname = table.Column(type: "text", nullable: false),
+ Erstelldatum = table.Column(type: "text", nullable: false),
+ Strasse = table.Column(type: "text", nullable: false),
+ Ort = table.Column(type: "text", nullable: false),
+ ExportType = table.Column(type: "integer", nullable: false),
+ Kodierungssystem = table.Column(type: "integer", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Projekte", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Schaechte",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Objektbezeichnung = table.Column(type: "text", nullable: false),
+ RechtsWert = table.Column(type: "numeric(18,4)", nullable: false),
+ HochWert = table.Column(type: "numeric(18,4)", nullable: false),
+ SohlHoehe = table.Column(type: "numeric(18,4)", nullable: false),
+ DeckelHoehe = table.Column(type: "numeric(18,4)", nullable: false),
+ Entwaesserung = table.Column(type: "integer", nullable: false),
+ ProjektId = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Objektbezeichnung = table.Column(type: "text", nullable: false),
+ StartSchachtId = table.Column(type: "integer", nullable: true),
+ EndSchachtId = table.Column(type: "integer", nullable: true),
+ DN = table.Column(type: "integer", nullable: false),
+ Material = table.Column(type: "text", nullable: false),
+ Haltungslaenge = table.Column(type: "numeric", nullable: false),
+ Entwaesserung = table.Column(type: "integer", nullable: false),
+ ProjektId = table.Column(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");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Auftraggebers");
+
+ migrationBuilder.DropTable(
+ name: "Kanaele");
+
+ migrationBuilder.DropTable(
+ name: "Schaechte");
+
+ migrationBuilder.DropTable(
+ name: "Projekte");
+ }
+ }
+}
diff --git a/SewerStammGen.EntityFramework/Migrations/SewerStammGenDbContextModelSnapshot.cs b/SewerStammGen.EntityFramework/Migrations/SewerStammGenDbContextModelSnapshot.cs
new file mode 100644
index 0000000..4213582
--- /dev/null
+++ b/SewerStammGen.EntityFramework/Migrations/SewerStammGenDbContextModelSnapshot.cs
@@ -0,0 +1,214 @@
+//
+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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Ansprechpartner")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Ort")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Postleitzahl")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Strasse")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Telefonnummer")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Auftraggebers");
+ });
+
+ modelBuilder.Entity("Shared.Domain.Kanal", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DN")
+ .HasColumnType("integer");
+
+ b.Property("EndSchachtId")
+ .HasColumnType("integer");
+
+ b.Property("Entwaesserung")
+ .HasColumnType("integer");
+
+ b.Property("Haltungslaenge")
+ .HasColumnType("numeric");
+
+ b.Property("Material")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Objektbezeichnung")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ProjektId")
+ .HasColumnType("integer");
+
+ b.Property("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Erstelldatum")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ExportType")
+ .HasColumnType("integer");
+
+ b.Property("Kodierungssystem")
+ .HasColumnType("integer");
+
+ b.Property("Ort")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Projektname")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Strasse")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Projekte");
+ });
+
+ modelBuilder.Entity("Shared.Domain.Schacht", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DeckelHoehe")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("Entwaesserung")
+ .HasColumnType("integer");
+
+ b.Property("HochWert")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("Objektbezeichnung")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ProjektId")
+ .HasColumnType("integer");
+
+ b.Property("RechtsWert")
+ .HasColumnType("decimal(18,4)");
+
+ b.Property("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
+ }
+ }
+}
diff --git a/SewerStammGen.EntityFramework/Services/Common/NonQueryDataService.cs b/SewerStammGen.EntityFramework/Services/Common/NonQueryDataService.cs
new file mode 100644
index 0000000..06bc73b
--- /dev/null
+++ b/SewerStammGen.EntityFramework/Services/Common/NonQueryDataService.cs
@@ -0,0 +1,54 @@
+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 where T: DBObject
+ {
+ private readonly SewerStammGenDbContextFactory _contextFactory;
+
+ public NonQueryDataService(SewerStammGenDbContextFactory contextFactory)
+ {
+ _contextFactory = contextFactory;
+ }
+ public async Task Create(T entity)
+ {
+ using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
+ EntityEntry createdEntity = await context.Set().AddAsync(entity);
+ await context.SaveChangesAsync();
+ return createdEntity.Entity;
+ }
+
+ public T CreateNonAsync(T entity)
+ {
+ using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
+ EntityEntry createdEntity = context.Set().Add(entity);
+ context.SaveChanges();
+ return createdEntity.Entity;
+ }
+
+ public async Task Delete(int id)
+ {
+ using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
+ T entity = await context.Set().FirstOrDefaultAsync((e) => e.Id == id);
+ context.Set().Remove(entity);
+ await context.SaveChangesAsync();
+ return true;
+ }
+ public async Task Update(int id, T entity)
+ {
+ using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
+ entity.Id = id;
+ context.Set().Update(entity);
+ await context.SaveChangesAsync();
+ return entity;
+ }
+
+ }
+}
diff --git a/SewerStammGen.EntityFramework/Services/GenericDataService.cs b/SewerStammGen.EntityFramework/Services/GenericDataService.cs
new file mode 100644
index 0000000..69752a3
--- /dev/null
+++ b/SewerStammGen.EntityFramework/Services/GenericDataService.cs
@@ -0,0 +1,67 @@
+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 : IDataService where T : DBObject
+ {
+ private readonly SewerStammGenDbContextFactory _contextFactory;
+ private readonly NonQueryDataService _nonQueryDataService;
+
+ public GenericDataService(SewerStammGenDbContextFactory contextFactory)
+ {
+ _contextFactory = contextFactory;
+ _nonQueryDataService = new NonQueryDataService(contextFactory);
+ }
+
+ public async Task Create(T entity)
+ {
+ return await _nonQueryDataService.Create(entity);
+ }
+
+ public T CreateNonAsync(T entity)
+ {
+ return _nonQueryDataService.CreateNonAsync(entity);
+ }
+
+ public async Task Delete(int id)
+ {
+ return await (_nonQueryDataService.Delete(id));
+ }
+
+ public async Task Get(int id)
+ {
+ using(SewerStammGenDbContext context = _contextFactory.CreateDbContext())
+ {
+ T entity = await context.Set().FirstOrDefaultAsync((e) => e.Id == id);
+ return entity;
+ }
+ }
+
+ public async Task> GetAll()
+ {
+ using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
+ {
+ IEnumerable entities = await context.Set().ToListAsync();
+ return entities;
+ }
+ }
+
+ public async Task Update(int id, T entity)
+ {
+ return await _nonQueryDataService.Update(id, entity);
+ }
+
+ T IDataService.CreateNonAsync(T entity)
+ {
+ return _nonQueryDataService.CreateNonAsync(entity);
+ }
+ }
+}
diff --git a/SewerStammGen.EntityFramework/SewerStammGen.EntityFramework.csproj b/SewerStammGen.EntityFramework/SewerStammGen.EntityFramework.csproj
new file mode 100644
index 0000000..4ed4142
--- /dev/null
+++ b/SewerStammGen.EntityFramework/SewerStammGen.EntityFramework.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net7.0
+ enable
+ enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
diff --git a/SewerStammGen.EntityFramework/SewerStammGenDbContext.cs b/SewerStammGen.EntityFramework/SewerStammGenDbContext.cs
new file mode 100644
index 0000000..86bdb05
--- /dev/null
+++ b/SewerStammGen.EntityFramework/SewerStammGenDbContext.cs
@@ -0,0 +1,20 @@
+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? Schaechte { get; set; }
+ public DbSet? Projekte { get; set; }
+ public DbSet? Kanaele { get; set; }
+ public DbSet? Auftraggebers { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/SewerStammGen.EntityFramework/SewerStammGenDbContextFactory.cs b/SewerStammGen.EntityFramework/SewerStammGenDbContextFactory.cs
new file mode 100644
index 0000000..0e3621e
--- /dev/null
+++ b/SewerStammGen.EntityFramework/SewerStammGenDbContextFactory.cs
@@ -0,0 +1,37 @@
+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
+ {
+ private readonly Action _configureDbContext;
+
+ public SewerStammGenDbContextFactory() { }
+
+ public SewerStammGenDbContextFactory(Action configureDbContext)
+ {
+ _configureDbContext = configureDbContext;
+ }
+
+ public SewerStammGenDbContext CreateDbContext()
+ {
+ DbContextOptionsBuilder? options = new();
+ _configureDbContext( options );
+ return new SewerStammGenDbContext(options.Options);
+ }
+
+ public SewerStammGenDbContext CreateDbContext(string[] args)
+ {
+ var options = new DbContextOptionsBuilder();
+ options.UseNpgsql("Host = localhost; Database = SewerGen; Username = SewerGen; Password = SewerGen");
+ SewerStammGenDbContext result = new(options.Options);
+ return result;
+ }
+ }
+}
diff --git a/SewerStammGen/SewerStammGen.csproj b/SewerStammGen/SewerStammGen.csproj
index 819c0f6..bb89541 100644
--- a/SewerStammGen/SewerStammGen.csproj
+++ b/SewerStammGen/SewerStammGen.csproj
@@ -8,6 +8,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/Shared/Contracts/IDataService.cs b/Shared/Contracts/IDataService.cs
new file mode 100644
index 0000000..c87d5b5
--- /dev/null
+++ b/Shared/Contracts/IDataService.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Contracts
+{
+ public interface IDataService
+ {
+ Task> GetAll();
+ Task Get(int id);
+ Task Create(T entity);
+ Task Update(int id,T entity);
+ Task Delete(int id);
+ T CreateNonAsync(T entity);
+ }
+}
diff --git a/Shared/Domain/Auftraggeber.cs b/Shared/Domain/Auftraggeber.cs
new file mode 100644
index 0000000..0f709c7
--- /dev/null
+++ b/Shared/Domain/Auftraggeber.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Domain
+{
+ public class Auftraggeber : DBObject
+ {
+ public string Name { get; set; }
+ public string Strasse { get; set; }
+ public string Ort { get; set; }
+ public string Postleitzahl { get; set; }
+ public string Ansprechpartner { get; set; }
+ public string Telefonnummer { get; set; }
+ }
+}
diff --git a/Shared/Domain/DBObject.cs b/Shared/Domain/DBObject.cs
new file mode 100644
index 0000000..ac26a6e
--- /dev/null
+++ b/Shared/Domain/DBObject.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Domain
+{
+ public class DBObject
+ {
+ public int Id { get; set; }
+ }
+}
diff --git a/Shared/Domain/Kanal.cs b/Shared/Domain/Kanal.cs
index 1b9b1aa..51e8c76 100644
--- a/Shared/Domain/Kanal.cs
+++ b/Shared/Domain/Kanal.cs
@@ -6,14 +6,15 @@ using System.Threading.Tasks;
namespace Shared.Domain
{
- public class Kanal
+ public class Kanal : DBObject
{
- public int Id { get; set; }
public string Objektbezeichnung { get; set; }
- Schacht? startSchacht = null;
- Schacht? endSchacht = null;
+ public Schacht? StartSchacht { get; set; }
+ public Schacht? EndSchacht { get; set; }
public int DN { get; set; }
public string Material { get; set; }
+ public decimal Haltungslaenge { get; set; }
+ public EEntwaeserung Entwaesserung { get; set; }
}
}
diff --git a/Shared/Domain/Projekt.cs b/Shared/Domain/Projekt.cs
new file mode 100644
index 0000000..7982580
--- /dev/null
+++ b/Shared/Domain/Projekt.cs
@@ -0,0 +1,21 @@
+using Shared.Enum;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Domain
+{
+ public class Projekt : DBObject
+ {
+ public string Projektname { get; set; }
+ public string Erstelldatum { get; set; }
+ public string Strasse { get;set; }
+ public string Ort { get; set; }
+ public EExportType ExportType { get; set; }
+ public EKodierungssystem Kodierungssystem { get; set; }
+ public IList Kanaele { get; set; }
+ public IList Schaechte { get; set;}
+ }
+}
diff --git a/Shared/Domain/Schacht.cs b/Shared/Domain/Schacht.cs
index bac7f53..34fb380 100644
--- a/Shared/Domain/Schacht.cs
+++ b/Shared/Domain/Schacht.cs
@@ -7,9 +7,8 @@ using System.Threading.Tasks;
namespace Shared.Domain
{
- public class Schacht
+ public class Schacht : DBObject
{
- public int Id { get; set; }
public string Objektbezeichnung { get; set; }
[Column(TypeName = "decimal(18,4)")]
@@ -23,5 +22,13 @@ namespace Shared.Domain
[Column(TypeName = "decimal(18,4)")]
public decimal DeckelHoehe { get; set; }
+ public EEntwaeserung Entwaesserung { get; set; }
+ }
+
+ public enum EEntwaeserung
+ {
+ Regenwasser,
+ Schmutzwasser,
+ Mischwasser
}
}
diff --git a/Shared/Enum/EExportType.cs b/Shared/Enum/EExportType.cs
new file mode 100644
index 0000000..64e31e2
--- /dev/null
+++ b/Shared/Enum/EExportType.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Enum
+{
+ public enum EExportType
+ {
+ KANDIS4,
+ KANDIS6,
+ M150,
+ XML2006,
+ XML2013,
+ XML2017
+ }
+}
diff --git a/Shared/Enum/EKodierungssystem.cs b/Shared/Enum/EKodierungssystem.cs
new file mode 100644
index 0000000..ea5bc24
--- /dev/null
+++ b/Shared/Enum/EKodierungssystem.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shared.Enum
+{
+ public enum EKodierungssystem
+ {
+ EN13508_2_2003,
+ EN13508_2_2003_DWA_M_192_2,
+ EN13508_2_2003_ARBEITSHILFEN_ABWASSER,
+ EN13508_2_2011,
+ EN13508_2_2011_DWA_M_192_2,
+ EN13508_2_2011_ARBEITSHILFEN_ABWASSER
+ }
+}
diff --git a/Stammdatengenerator.sln b/Stammdatengenerator.sln
index 279c2ab..dd3aa34 100644
--- a/Stammdatengenerator.sln
+++ b/Stammdatengenerator.sln
@@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen", "SewerStammGen\SewerStammGen.csproj", "{7052AE7B-9E3C-4C04-9756-7488D21512C1}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen", "SewerStammGen\SewerStammGen.csproj", "{7052AE7B-9E3C-4C04-9756-7488D21512C1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen.EntityFramework", "SewerStammGen.EntityFramework\SewerStammGen.EntityFramework.csproj", "{803CB44F-F68C-4872-8408-047D02BBF201}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +23,10 @@ Global
{3A47BD31-36C2-45C4-9609-D0D9D92A993B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A47BD31-36C2-45C4-9609-D0D9D92A993B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A47BD31-36C2-45C4-9609-D0D9D92A993B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {803CB44F-F68C-4872-8408-047D02BBF201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {803CB44F-F68C-4872-8408-047D02BBF201}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {803CB44F-F68C-4872-8408-047D02BBF201}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {803CB44F-F68C-4872-8408-047D02BBF201}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE