Datenbank umgebaut
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
public class Baustelle
|
||||
{
|
||||
public Guid BaustelleID { get; set; }
|
||||
public Kunden Kunde { get; } = new Kunden();
|
||||
public string Ort { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
}
|
||||
}
|
||||
23
KanSan/Klassen/Baustelle.cs
Normal file
23
KanSan/Klassen/Baustelle.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace KanSan.Klassen
|
||||
{
|
||||
public class Baustelle
|
||||
{
|
||||
public Guid ID { get; set; }
|
||||
public Kunde Kunde { get; set; }
|
||||
public string Ort { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
public string Projektnummer { get; set; }
|
||||
|
||||
public Baustelle(Kunde kunde)
|
||||
{
|
||||
Kunde = kunde;
|
||||
}
|
||||
|
||||
public Baustelle()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
29
KanSan/Klassen/Kunde.cs
Normal file
29
KanSan/Klassen/Kunde.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KanSan.Klassen
|
||||
{
|
||||
public class Kunde
|
||||
{
|
||||
public Guid ID { get; set; }
|
||||
public string Vorname { get; set; }
|
||||
public string Nachname { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
public string PLZ { get; set; }
|
||||
public string Ort { get; set; }
|
||||
|
||||
public List<Baustelle> Baustellen { get; } = new List<Baustelle>();
|
||||
|
||||
public void NeueBaustelle(string ort, string strasse, string projektnummer)
|
||||
{
|
||||
Baustelle baustelle = new Baustelle(this)
|
||||
{
|
||||
Ort = ort,
|
||||
ID = Guid.NewGuid(),
|
||||
Projektnummer = projektnummer,
|
||||
Strasse = Strasse
|
||||
};
|
||||
Baustellen.Add(baustelle);
|
||||
}
|
||||
}
|
||||
}
|
||||
42
KanSan/Klassen/Leistungsverzeichnis.cs
Normal file
42
KanSan/Klassen/Leistungsverzeichnis.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace KanSan.Klassen
|
||||
{
|
||||
public class Leistungsverzeichnis
|
||||
{
|
||||
public Guid ID { get; set; }
|
||||
public string Beschreibung { get; set; }
|
||||
public List<LeistungsverzeichnisPosition> Positionen { get; set; }
|
||||
public Leistungsverzeichnis(string beschreibung)
|
||||
{
|
||||
ID = Guid.NewGuid();
|
||||
Beschreibung = beschreibung;
|
||||
}
|
||||
|
||||
public void AddLeistungsverzeichnisPosition(string Positionnummer,string PositionsBeschreibung,string PositionEinheit, decimal PositionEinheitpreis)
|
||||
{
|
||||
if (Positionen == null) Positionen = new List<LeistungsverzeichnisPosition>();
|
||||
LeistungsverzeichnisPosition pos = new LeistungsverzeichnisPosition();
|
||||
pos.ID = Guid.NewGuid();
|
||||
pos.ref_leistungsverzeichnis = this;
|
||||
pos.Position = Positionnummer;
|
||||
pos.PositionBeschreibung = PositionsBeschreibung;
|
||||
pos.PositionEinheit = PositionEinheit;
|
||||
pos.PositionEinheitspreis = PositionEinheitpreis;
|
||||
|
||||
Positionen.Add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public class LeistungsverzeichnisPosition
|
||||
{
|
||||
public Guid ID { get; set; }
|
||||
public Leistungsverzeichnis ref_leistungsverzeichnis { get; set; }
|
||||
public string Position { get; set; }
|
||||
public string PositionBeschreibung { get; set; }
|
||||
public string PositionEinheit { get; set; }
|
||||
public decimal PositionEinheitspreis { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace KanSan
|
||||
namespace KanSan.Klassen
|
||||
{
|
||||
public class LeistungsverzeichnisBaustelle
|
||||
{
|
||||
public int LeistungsverzeichnisBaustelleID { get; set; }
|
||||
public Baustelle Baustelle { get; set; }
|
||||
public Leistungsverzeichniss Leistungsverzeichniss { get; set; }
|
||||
public Leistungsverzeichnis Leistungsverzeichniss { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
public class Kunden
|
||||
{
|
||||
public Guid KundenID { get; set; }
|
||||
public string Vorname { get; set; }
|
||||
public string Nachname { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
public string PLZ { get; set; }
|
||||
public string Ort { get; set; }
|
||||
|
||||
public List<Baustelle> Baustellen { get; } = new List<Baustelle>();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
public class Leistungsverzeichniss
|
||||
{
|
||||
public Guid LeistungsverzeichnissID { get; set; }
|
||||
public string Position { get; set; }
|
||||
public string PositionBeschreibung { get; set; }
|
||||
public string PositionEinheit { get; set; }
|
||||
public decimal PositionEinheitspreis { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using KanSan.Klassen;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
@@ -26,14 +28,85 @@ namespace KanSan
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static void InsertOrUpdateGraph(KanSanContext context, Kunde kunde)
|
||||
{
|
||||
var existingKunde = context.Kunden
|
||||
.Include(b => b.Baustellen)
|
||||
.FirstOrDefault(b => b.ID == kunde.ID);
|
||||
|
||||
if (existingKunde == null)
|
||||
context.Add(kunde);
|
||||
else
|
||||
{
|
||||
context.Entry(existingKunde).CurrentValues.SetValues(kunde);
|
||||
foreach(var baustelle in kunde.Baustellen)
|
||||
{
|
||||
var existingBaustelle = existingKunde.Baustellen
|
||||
.FirstOrDefault(p => p.ID == baustelle.ID);
|
||||
if(existingBaustelle == null)
|
||||
{
|
||||
existingKunde.Baustellen.Add(baustelle);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Entry(existingBaustelle).CurrentValues.SetValues(baustelle);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
List<Baustelle> baustellen;
|
||||
using (KanSanContext ksc = new KanSanContext())
|
||||
{
|
||||
baustellen = ksc.Baustellen.ToList();
|
||||
var kunden = ksc.Kunden.First();
|
||||
//kunden.NeueBaustelle("Oldenburg", "Ammerländer", "20-850-006");
|
||||
|
||||
InsertOrUpdateGraph(ksc, kunden);
|
||||
}
|
||||
|
||||
/*InitialKundenDatabase();
|
||||
InitialLeistungsverzeichnis();
|
||||
*/
|
||||
}
|
||||
private void InitialKundenDatabase()
|
||||
{
|
||||
Kunde kunde = new Kunde()
|
||||
{
|
||||
Vorname = "Fa.",
|
||||
Nachname = "OOWV",
|
||||
Ort = "Brake",
|
||||
PLZ = "268741",
|
||||
Strasse = "Donnerschweerstraße 74"
|
||||
};
|
||||
|
||||
kunde.NeueBaustelle("Oldenburg", "Kaspersweg", "20-850-003");
|
||||
using (KanSanContext ksc = new KanSanContext())
|
||||
{
|
||||
ksc.Kunden.Add(kunde);
|
||||
ksc.SaveChanges();
|
||||
}
|
||||
}
|
||||
private void InitialLeistungsverzeichnis()
|
||||
{
|
||||
using (KanSanContext ksc = new KanSanContext())
|
||||
{
|
||||
|
||||
Leistungsverzeichnis leistungsverzeichnis = new Leistungsverzeichnis("JunkerMevesGenerell");
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.01", "Kurzliner", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.02", "Mat KL", "m", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.03", "Stutzen Hut", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.04", "Stutzen andere", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.05", "VA-Manschette", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.06", "Öffnen", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.07", "Fräsen", "h", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.08", "Hindernisse", "Stk", 0);
|
||||
leistungsverzeichnis.AddLeistungsverzeichnisPosition("0.09", "Anrauhen", "Stk", 0);
|
||||
|
||||
ksc.Leistungsverzeichnisses.Add(leistungsverzeichnis);
|
||||
ksc.SaveChanges();
|
||||
}
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace KanSan.Migrations
|
||||
{
|
||||
[DbContext(typeof(KanSanContext))]
|
||||
[Migration("20200213193512_InitialCommit")]
|
||||
[Migration("20200216122731_InitialCommit")]
|
||||
partial class InitialCommit
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -21,31 +21,34 @@ namespace KanSan.Migrations
|
||||
.HasAnnotation("ProductVersion", "3.1.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("KanSan.Baustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Baustelle", b =>
|
||||
{
|
||||
b.Property<Guid>("BaustelleID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("KundenID")
|
||||
b.Property<Guid?>("KundeID")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Ort")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Projektnummer")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Strasse")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("BaustelleID");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("KundenID");
|
||||
b.HasIndex("KundeID");
|
||||
|
||||
b.ToTable("Baustellen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Kunden", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Kunde", b =>
|
||||
{
|
||||
b.Property<Guid>("KundenID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -64,12 +67,26 @@ namespace KanSan.Migrations
|
||||
b.Property<string>("Vorname")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("KundenID");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Kunden");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Leistungsverzeichnis", b =>
|
||||
{
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Beschreibung")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Leistungsverzeichnisses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisBaustelle", b =>
|
||||
{
|
||||
b.Property<int>("LeistungsverzeichnisBaustelleID")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -91,9 +108,9 @@ namespace KanSan.Migrations
|
||||
b.ToTable("LeistungsverzeichnisBaustelle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisPosition", b =>
|
||||
{
|
||||
b.Property<Guid>("LeistungsverzeichnissID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -109,28 +126,40 @@ namespace KanSan.Migrations
|
||||
b.Property<decimal>("PositionEinheitspreis")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.HasKey("LeistungsverzeichnissID");
|
||||
b.Property<Guid?>("ref_leistungsverzeichnisID")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.ToTable("Leistungsverzeichnisses");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ref_leistungsverzeichnisID");
|
||||
|
||||
b.ToTable("LeistungsverzeichnisPosition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Baustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Baustelle", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Kunden", null)
|
||||
b.HasOne("KanSan.Klassen.Kunde", null)
|
||||
.WithMany("Baustellen")
|
||||
.HasForeignKey("KundenID");
|
||||
.HasForeignKey("KundeID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisBaustelle", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Baustelle", "Baustelle")
|
||||
b.HasOne("KanSan.Klassen.Baustelle", "Baustelle")
|
||||
.WithMany()
|
||||
.HasForeignKey("BaustelleID");
|
||||
|
||||
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
|
||||
b.HasOne("KanSan.Klassen.Leistungsverzeichnis", "Leistungsverzeichniss")
|
||||
.WithMany()
|
||||
.HasForeignKey("LeistungsverzeichnissID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisPosition", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Klassen.Leistungsverzeichnis", "ref_leistungsverzeichnis")
|
||||
.WithMany("Positionen")
|
||||
.HasForeignKey("ref_leistungsverzeichnisID");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace KanSan.Migrations
|
||||
name: "Kunden",
|
||||
columns: table => new
|
||||
{
|
||||
KundenID = table.Column<Guid>(nullable: false),
|
||||
ID = table.Column<Guid>(nullable: false),
|
||||
Vorname = table.Column<string>(nullable: true),
|
||||
Nachname = table.Column<string>(nullable: true),
|
||||
Strasse = table.Column<string>(nullable: true),
|
||||
@@ -21,14 +21,48 @@ namespace KanSan.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Kunden", x => x.KundenID);
|
||||
table.PrimaryKey("PK_Kunden", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Leistungsverzeichnisses",
|
||||
columns: table => new
|
||||
{
|
||||
LeistungsverzeichnissID = table.Column<Guid>(nullable: false),
|
||||
ID = table.Column<Guid>(nullable: false),
|
||||
Beschreibung = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leistungsverzeichnisses", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Baustellen",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<Guid>(nullable: false),
|
||||
Ort = table.Column<string>(nullable: true),
|
||||
Strasse = table.Column<string>(nullable: true),
|
||||
Projektnummer = table.Column<string>(nullable: true),
|
||||
KundeID = table.Column<Guid>(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.CreateTable(
|
||||
name: "LeistungsverzeichnisPosition",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<Guid>(nullable: false),
|
||||
ref_leistungsverzeichnisID = table.Column<Guid>(nullable: true),
|
||||
Position = table.Column<string>(nullable: true),
|
||||
PositionBeschreibung = table.Column<string>(nullable: true),
|
||||
PositionEinheit = table.Column<string>(nullable: true),
|
||||
@@ -36,26 +70,12 @@ namespace KanSan.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leistungsverzeichnisses", x => x.LeistungsverzeichnissID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Baustellen",
|
||||
columns: table => new
|
||||
{
|
||||
BaustelleID = table.Column<Guid>(nullable: false),
|
||||
Ort = table.Column<string>(nullable: true),
|
||||
Strasse = table.Column<string>(nullable: true),
|
||||
KundenID = table.Column<Guid>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Baustellen", x => x.BaustelleID);
|
||||
table.PrimaryKey("PK_LeistungsverzeichnisPosition", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Baustellen_Kunden_KundenID",
|
||||
column: x => x.KundenID,
|
||||
principalTable: "Kunden",
|
||||
principalColumn: "KundenID",
|
||||
name: "FK_LeistungsverzeichnisPosition_Leistungsverzeichnisses_ref_le~",
|
||||
column: x => x.ref_leistungsverzeichnisID,
|
||||
principalTable: "Leistungsverzeichnisses",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
@@ -75,20 +95,20 @@ namespace KanSan.Migrations
|
||||
name: "FK_LeistungsverzeichnisBaustelle_Baustellen_BaustelleID",
|
||||
column: x => x.BaustelleID,
|
||||
principalTable: "Baustellen",
|
||||
principalColumn: "BaustelleID",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LeistungsverzeichnisBaustelle_Leistungsverzeichnisses_Leist~",
|
||||
column: x => x.LeistungsverzeichnissID,
|
||||
principalTable: "Leistungsverzeichnisses",
|
||||
principalColumn: "LeistungsverzeichnissID",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Baustellen_KundenID",
|
||||
name: "IX_Baustellen_KundeID",
|
||||
table: "Baustellen",
|
||||
column: "KundenID");
|
||||
column: "KundeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LeistungsverzeichnisBaustelle_BaustelleID",
|
||||
@@ -99,6 +119,11 @@ namespace KanSan.Migrations
|
||||
name: "IX_LeistungsverzeichnisBaustelle_LeistungsverzeichnissID",
|
||||
table: "LeistungsverzeichnisBaustelle",
|
||||
column: "LeistungsverzeichnissID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LeistungsverzeichnisPosition_ref_leistungsverzeichnisID",
|
||||
table: "LeistungsverzeichnisPosition",
|
||||
column: "ref_leistungsverzeichnisID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
@@ -106,6 +131,9 @@ namespace KanSan.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "LeistungsverzeichnisBaustelle");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LeistungsverzeichnisPosition");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Baustellen");
|
||||
|
||||
@@ -19,31 +19,34 @@ namespace KanSan.Migrations
|
||||
.HasAnnotation("ProductVersion", "3.1.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("KanSan.Baustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Baustelle", b =>
|
||||
{
|
||||
b.Property<Guid>("BaustelleID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("KundenID")
|
||||
b.Property<Guid?>("KundeID")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Ort")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Projektnummer")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Strasse")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("BaustelleID");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("KundenID");
|
||||
b.HasIndex("KundeID");
|
||||
|
||||
b.ToTable("Baustellen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Kunden", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Kunde", b =>
|
||||
{
|
||||
b.Property<Guid>("KundenID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -62,12 +65,26 @@ namespace KanSan.Migrations
|
||||
b.Property<string>("Vorname")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("KundenID");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Kunden");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Leistungsverzeichnis", b =>
|
||||
{
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Beschreibung")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Leistungsverzeichnisses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisBaustelle", b =>
|
||||
{
|
||||
b.Property<int>("LeistungsverzeichnisBaustelleID")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -89,9 +106,9 @@ namespace KanSan.Migrations
|
||||
b.ToTable("LeistungsverzeichnisBaustelle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisPosition", b =>
|
||||
{
|
||||
b.Property<Guid>("LeistungsverzeichnissID")
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -107,28 +124,40 @@ namespace KanSan.Migrations
|
||||
b.Property<decimal>("PositionEinheitspreis")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.HasKey("LeistungsverzeichnissID");
|
||||
b.Property<Guid?>("ref_leistungsverzeichnisID")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.ToTable("Leistungsverzeichnisses");
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ref_leistungsverzeichnisID");
|
||||
|
||||
b.ToTable("LeistungsverzeichnisPosition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Baustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.Baustelle", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Kunden", null)
|
||||
b.HasOne("KanSan.Klassen.Kunde", null)
|
||||
.WithMany("Baustellen")
|
||||
.HasForeignKey("KundenID");
|
||||
.HasForeignKey("KundeID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisBaustelle", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Baustelle", "Baustelle")
|
||||
b.HasOne("KanSan.Klassen.Baustelle", "Baustelle")
|
||||
.WithMany()
|
||||
.HasForeignKey("BaustelleID");
|
||||
|
||||
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
|
||||
b.HasOne("KanSan.Klassen.Leistungsverzeichnis", "Leistungsverzeichniss")
|
||||
.WithMany()
|
||||
.HasForeignKey("LeistungsverzeichnissID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("KanSan.Klassen.LeistungsverzeichnisPosition", b =>
|
||||
{
|
||||
b.HasOne("KanSan.Klassen.Leistungsverzeichnis", "ref_leistungsverzeichnis")
|
||||
.WithMany("Positionen")
|
||||
.HasForeignKey("ref_leistungsverzeichnisID");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@ using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using KanSan.Klassen;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
public class KanSanContext : DbContext
|
||||
{
|
||||
|
||||
public DbSet<Kunden> Kunden { get; set; }
|
||||
public DbSet<Leistungsverzeichniss> Leistungsverzeichnisses { get; set; }
|
||||
public DbSet<Kunde> Kunden { get; set; }
|
||||
public DbSet<Leistungsverzeichnis> Leistungsverzeichnisses { get; set; }
|
||||
public DbSet<LeistungsverzeichnisBaustelle> LeistungsverzeichnisBaustelle { get; set; }
|
||||
public DbSet<LeistungsverzeichnisPosition> LeistungsverzeichnisPosition { get; set; }
|
||||
public DbSet<Baustelle> Baustellen { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
@@ -31,8 +33,4 @@ namespace KanSan
|
||||
}
|
||||
*/
|
||||
}
|
||||
class Model
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user