Klassen erweitert
This commit is contained in:
9
KanSan.Base/Enums/EMaterial.cs
Normal file
9
KanSan.Base/Enums/EMaterial.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace KanSan.Base.Enums
|
||||||
|
{
|
||||||
|
public enum EMaterial
|
||||||
|
{
|
||||||
|
Steinzeug,
|
||||||
|
Beton,
|
||||||
|
Polypropolen
|
||||||
|
}
|
||||||
|
}
|
||||||
10
KanSan.Base/Enums/EPunktType.cs
Normal file
10
KanSan.Base/Enums/EPunktType.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace KanSan.Base.Enums
|
||||||
|
{
|
||||||
|
public enum EPunktType
|
||||||
|
{
|
||||||
|
Leitung,
|
||||||
|
Haltung,
|
||||||
|
Schacht,
|
||||||
|
Anschlusspunkt
|
||||||
|
}
|
||||||
|
}
|
||||||
12
KanSan.Base/Interfaces/IDatabaseEntry.cs
Normal file
12
KanSan.Base/Interfaces/IDatabaseEntry.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDatabaseEntry
|
||||||
|
{
|
||||||
|
int ID { get; set; }
|
||||||
|
Guid GuidNr { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace KanSan.Base.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IUnitOfWork
|
public interface IUnitOfWork
|
||||||
{
|
{
|
||||||
IRepository<Baustelle> BaustellenRepository { get; }
|
IRepository<Projekt> BaustellenRepository { get; }
|
||||||
IRepository<Kunde> KundenRepository { get; }
|
IRepository<Kunde> KundenRepository { get; }
|
||||||
void Commit();
|
void Commit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ namespace KanSan.Base
|
|||||||
{
|
{
|
||||||
public class KanSanContext : DbContext
|
public class KanSanContext : DbContext
|
||||||
{
|
{
|
||||||
public DbSet<Baustelle> Baustellen { get; set; }
|
public DbSet<Projekt> Projekte { get; set; }
|
||||||
public DbSet<Kunde> Kunden { get; set; }
|
public DbSet<Kunde> Kunden { get; set; }
|
||||||
|
public DbSet<Sewer> Kanaele { get; set; }
|
||||||
|
public DbSet<SewerPoint> SewerPoints { get; set; }
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlite("Data Source=kansan.db");
|
optionsBuilder.UseSqlite("Data Source=kansan.db");
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using KanSan.Base;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
namespace KanSan.Base.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(KanSanContext))]
|
|
||||||
[Migration("20200220200339_InitialCommit")]
|
|
||||||
partial class InitialCommit
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "3.1.1");
|
|
||||||
|
|
||||||
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<Guid>("GuidNr")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int?>("KundeID")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Ort")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Projektnummer")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Strasse")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("KundeID");
|
|
||||||
|
|
||||||
b.ToTable("Baustellen");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("KanSan.Base.Models.Kunde", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<Guid>("GuidNr")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Nachname")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Ort")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("PLZ")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Strasse")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Vorname")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Kunden");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("KanSan.Base.Models.Kunde", "Kunde")
|
|
||||||
.WithMany("Baustellen")
|
|
||||||
.HasForeignKey("KundeID");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace KanSan.Base.Migrations
|
|
||||||
{
|
|
||||||
public partial class InitialCommit : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Kunden",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ID = table.Column<int>(nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
GuidNr = table.Column<Guid>(nullable: false),
|
|
||||||
Vorname = table.Column<string>(nullable: true),
|
|
||||||
Nachname = table.Column<string>(nullable: true),
|
|
||||||
Strasse = table.Column<string>(nullable: true),
|
|
||||||
PLZ = table.Column<string>(nullable: true),
|
|
||||||
Ort = table.Column<string>(nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Kunden", x => x.ID);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Baustellen",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ID = table.Column<int>(nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
GuidNr = table.Column<Guid>(nullable: false),
|
|
||||||
KundeID = table.Column<int>(nullable: true),
|
|
||||||
Ort = table.Column<string>(nullable: true),
|
|
||||||
Strasse = table.Column<string>(nullable: true),
|
|
||||||
Projektnummer = table.Column<string>(nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Baustellen", x => x.ID);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Baustellen_Kunden_KundeID",
|
|
||||||
column: x => x.KundeID,
|
|
||||||
principalTable: "Kunden",
|
|
||||||
principalColumn: "ID",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Baustellen_KundeID",
|
|
||||||
table: "Baustellen",
|
|
||||||
column: "KundeID");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Baustellen");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Kunden");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
198
KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs
generated
Normal file
198
KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs
generated
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using KanSan.Base;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(KanSanContext))]
|
||||||
|
[Migration("20200221084801_InitialCommit")]
|
||||||
|
partial class InitialCommit
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "3.1.1");
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("BaustelleNummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("OrtTeil")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ProjektID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("ProjektID");
|
||||||
|
|
||||||
|
b.ToTable("Baustelle");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Kunde", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Nachname")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Ort")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PLZ")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Strasse")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Vorname")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.ToTable("Kunden");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Projekt", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("KundeID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Ort")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Projektnummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("KundeID");
|
||||||
|
|
||||||
|
b.ToTable("Projekte");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Sewer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("BaustelleID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("DN")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Material")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ObjektNummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktObenID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PunktTypeOben")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PunktTypeUnten")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktUntenID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SewerType")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("StrasseName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("BaustelleID");
|
||||||
|
|
||||||
|
b.HasIndex("PunktObenID");
|
||||||
|
|
||||||
|
b.HasIndex("PunktUntenID");
|
||||||
|
|
||||||
|
b.ToTable("Kanaele");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.SewerPoint", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Objektnummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.ToTable("SewerPoints");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("KanSan.Base.Models.Projekt", "Projekt")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProjektID");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Projekt", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("KanSan.Base.Models.Kunde", "Kunde")
|
||||||
|
.WithMany("Baustellen")
|
||||||
|
.HasForeignKey("KundeID");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Sewer", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("KanSan.Base.Models.Baustelle", "Baustelle")
|
||||||
|
.WithMany("Kanaele")
|
||||||
|
.HasForeignKey("BaustelleID");
|
||||||
|
|
||||||
|
b.HasOne("KanSan.Base.Models.SewerPoint", "PunktOben")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktObenID");
|
||||||
|
|
||||||
|
b.HasOne("KanSan.Base.Models.SewerPoint", "PunktUnten")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktUntenID");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
171
KanSan.Base/Migrations/20200221084801_InitialCommit.cs
Normal file
171
KanSan.Base/Migrations/20200221084801_InitialCommit.cs
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Migrations
|
||||||
|
{
|
||||||
|
public partial class InitialCommit : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Kunden",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuidNr = table.Column<Guid>(nullable: false),
|
||||||
|
Vorname = table.Column<string>(nullable: true),
|
||||||
|
Nachname = table.Column<string>(nullable: true),
|
||||||
|
Strasse = table.Column<string>(nullable: true),
|
||||||
|
PLZ = table.Column<string>(nullable: true),
|
||||||
|
Ort = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Kunden", x => x.ID);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SewerPoints",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuidNr = table.Column<Guid>(nullable: false),
|
||||||
|
Objektnummer = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SewerPoints", x => x.ID);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Projekte",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuidNr = table.Column<Guid>(nullable: false),
|
||||||
|
KundeID = table.Column<int>(nullable: true),
|
||||||
|
Ort = table.Column<string>(nullable: true),
|
||||||
|
Projektnummer = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Projekte", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Projekte_Kunden_KundeID",
|
||||||
|
column: x => x.KundeID,
|
||||||
|
principalTable: "Kunden",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Baustelle",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuidNr = table.Column<Guid>(nullable: false),
|
||||||
|
ProjektID = table.Column<int>(nullable: true),
|
||||||
|
OrtTeil = table.Column<string>(nullable: true),
|
||||||
|
BaustelleNummer = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Baustelle", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Baustelle_Projekte_ProjektID",
|
||||||
|
column: x => x.ProjektID,
|
||||||
|
principalTable: "Projekte",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Kanaele",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuidNr = table.Column<Guid>(nullable: false),
|
||||||
|
BaustelleID = table.Column<int>(nullable: true),
|
||||||
|
StrasseName = table.Column<string>(nullable: true),
|
||||||
|
ObjektNummer = table.Column<string>(nullable: true),
|
||||||
|
SewerType = table.Column<int>(nullable: false),
|
||||||
|
PunktTypeOben = table.Column<int>(nullable: false),
|
||||||
|
PunktObenID = table.Column<int>(nullable: true),
|
||||||
|
PunktTypeUnten = table.Column<int>(nullable: false),
|
||||||
|
PunktUntenID = table.Column<int>(nullable: true),
|
||||||
|
DN = table.Column<int>(nullable: false),
|
||||||
|
Material = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Kanaele", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Kanaele_Baustelle_BaustelleID",
|
||||||
|
column: x => x.BaustelleID,
|
||||||
|
principalTable: "Baustelle",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Kanaele_SewerPoints_PunktObenID",
|
||||||
|
column: x => x.PunktObenID,
|
||||||
|
principalTable: "SewerPoints",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Kanaele_SewerPoints_PunktUntenID",
|
||||||
|
column: x => x.PunktUntenID,
|
||||||
|
principalTable: "SewerPoints",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Baustelle_ProjektID",
|
||||||
|
table: "Baustelle",
|
||||||
|
column: "ProjektID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Kanaele_BaustelleID",
|
||||||
|
table: "Kanaele",
|
||||||
|
column: "BaustelleID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Kanaele_PunktObenID",
|
||||||
|
table: "Kanaele",
|
||||||
|
column: "PunktObenID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Kanaele_PunktUntenID",
|
||||||
|
table: "Kanaele",
|
||||||
|
column: "PunktUntenID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Projekte_KundeID",
|
||||||
|
table: "Projekte",
|
||||||
|
column: "KundeID");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Kanaele");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Baustelle");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SewerPoints");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Projekte");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Kunden");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,26 +22,23 @@ namespace KanSan.Base.Migrations
|
|||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("BaustelleNummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<Guid>("GuidNr")
|
b.Property<Guid>("GuidNr")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int?>("KundeID")
|
b.Property<string>("OrtTeil")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ProjektID")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("Ort")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Projektnummer")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Strasse")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
b.HasIndex("KundeID");
|
b.HasIndex("ProjektID");
|
||||||
|
|
||||||
b.ToTable("Baustellen");
|
b.ToTable("Baustelle");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("KanSan.Base.Models.Kunde", b =>
|
modelBuilder.Entity("KanSan.Base.Models.Kunde", b =>
|
||||||
@@ -73,12 +70,126 @@ namespace KanSan.Base.Migrations
|
|||||||
b.ToTable("Kunden");
|
b.ToTable("Kunden");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Projekt", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("KundeID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Ort")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Projektnummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("KundeID");
|
||||||
|
|
||||||
|
b.ToTable("Projekte");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Sewer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("BaustelleID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("DN")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Material")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ObjektNummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktObenID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PunktTypeOben")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PunktTypeUnten")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktUntenID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("SewerType")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("StrasseName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("BaustelleID");
|
||||||
|
|
||||||
|
b.HasIndex("PunktObenID");
|
||||||
|
|
||||||
|
b.HasIndex("PunktUntenID");
|
||||||
|
|
||||||
|
b.ToTable("Kanaele");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.SewerPoint", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNr")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Objektnummer")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.ToTable("SewerPoints");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
modelBuilder.Entity("KanSan.Base.Models.Baustelle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("KanSan.Base.Models.Projekt", "Projekt")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProjektID");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Projekt", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("KanSan.Base.Models.Kunde", "Kunde")
|
b.HasOne("KanSan.Base.Models.Kunde", "Kunde")
|
||||||
.WithMany("Baustellen")
|
.WithMany("Baustellen")
|
||||||
.HasForeignKey("KundeID");
|
.HasForeignKey("KundeID");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("KanSan.Base.Models.Sewer", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("KanSan.Base.Models.Baustelle", "Baustelle")
|
||||||
|
.WithMany("Kanaele")
|
||||||
|
.HasForeignKey("BaustelleID");
|
||||||
|
|
||||||
|
b.HasOne("KanSan.Base.Models.SewerPoint", "PunktOben")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktObenID");
|
||||||
|
|
||||||
|
b.HasOne("KanSan.Base.Models.SewerPoint", "PunktUnten")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktUntenID");
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
using System;
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.Base.Models
|
namespace KanSan.Base.Models
|
||||||
{
|
{
|
||||||
public class Baustelle : DatenbankClass
|
public class Baustelle : IDatabaseEntry
|
||||||
{
|
{
|
||||||
public Kunde Kunde { get; set; }
|
public int ID { get; set; }
|
||||||
public string Ort { get; set; }
|
public Guid GuidNr { get; set; }
|
||||||
public string Strasse { get; set; }
|
public Projekt Projekt { get; set; }
|
||||||
public string Projektnummer { get; set; }
|
public string OrtTeil { get; set; }
|
||||||
|
public string BaustelleNummer { get; set; }
|
||||||
|
public List<Sewer> Kanaele { get; } = new List<Sewer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace KanSan.Base.Models
|
|
||||||
{
|
|
||||||
public class DatenbankClass
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
|
||||||
public Guid GuidNr { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
using System;
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.Base.Models
|
namespace KanSan.Base.Models
|
||||||
{
|
{
|
||||||
public class Kunde : DatenbankClass
|
public class Kunde : IDatabaseEntry
|
||||||
{
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public Guid GuidNr { get; set; }
|
||||||
public string Vorname { get; set; }
|
public string Vorname { get; set; }
|
||||||
public string Nachname { get; set; }
|
public string Nachname { get; set; }
|
||||||
public string Strasse { get; set; }
|
public string Strasse { get; set; }
|
||||||
public string PLZ { get; set; }
|
public string PLZ { get; set; }
|
||||||
public string Ort { get; set; }
|
public string Ort { get; set; }
|
||||||
public List<Baustelle> Baustellen { get; } = new List<Baustelle>();
|
public List<Projekt> Baustellen { get; } = new List<Projekt>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
KanSan.Base/Models/Projekt.cs
Normal file
16
KanSan.Base/Models/Projekt.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Models
|
||||||
|
{
|
||||||
|
public class Projekt : IDatabaseEntry
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public Guid GuidNr { get; set; }
|
||||||
|
public Kunde Kunde { get; set; }
|
||||||
|
public string Ort { get; set; }
|
||||||
|
public string Projektnummer { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
22
KanSan.Base/Models/Sewer.cs
Normal file
22
KanSan.Base/Models/Sewer.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using KanSan.Base.Enums;
|
||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Models
|
||||||
|
{
|
||||||
|
public class Sewer : IDatabaseEntry
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public Guid GuidNr { get; set; }
|
||||||
|
public Baustelle Baustelle { get; set; }
|
||||||
|
public string StrasseName { get; set; }
|
||||||
|
public string ObjektNummer { get; set; }
|
||||||
|
public EPunktType SewerType { get; set; }
|
||||||
|
public EPunktType PunktTypeOben { get; set; }
|
||||||
|
public SewerPoint PunktOben { get; set; }
|
||||||
|
public EPunktType PunktTypeUnten { get; set; }
|
||||||
|
public SewerPoint PunktUnten { get; set; }
|
||||||
|
public int DN { get; set; }
|
||||||
|
public EMaterial Material { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
KanSan.Base/Models/SewerPoint.cs
Normal file
12
KanSan.Base/Models/SewerPoint.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Models
|
||||||
|
{
|
||||||
|
public class SewerPoint : IDatabaseEntry
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public Guid GuidNr { get; set; }
|
||||||
|
public string Objektnummer { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ namespace KanSan.Base
|
|||||||
public class UnitOfWork : IUnitOfWork
|
public class UnitOfWork : IUnitOfWork
|
||||||
{
|
{
|
||||||
private KanSanContext _dbContext;
|
private KanSanContext _dbContext;
|
||||||
private BaseRepository<Baustelle> _baustellen;
|
private BaseRepository<Projekt> _baustellen;
|
||||||
private BaseRepository<Kunde> _kunden;
|
private BaseRepository<Kunde> _kunden;
|
||||||
|
|
||||||
public UnitOfWork(KanSanContext dbContext)
|
public UnitOfWork(KanSanContext dbContext)
|
||||||
@@ -17,11 +17,11 @@ namespace KanSan.Base
|
|||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRepository<Baustelle> BaustellenRepository
|
public IRepository<Projekt> BaustellenRepository
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _baustellen ?? (_baustellen = new BaseRepository<Baustelle>(_dbContext));
|
return _baustellen ?? (_baustellen = new BaseRepository<Projekt>(_dbContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace KanSan.ViewModel
|
|||||||
{
|
{
|
||||||
class BaustelleViewModel : PropertyChangedClass,INotifyPropertyChanged
|
class BaustelleViewModel : PropertyChangedClass,INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private Baustelle _baustelle;
|
private Projekt _baustelle;
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
private string ort;
|
private string ort;
|
||||||
|
|||||||
Reference in New Issue
Block a user