From 07e9a1c50b4b832e70e84a2c3aef775b76bad187 Mon Sep 17 00:00:00 2001 From: Husky Date: Thu, 13 Feb 2020 20:35:51 +0100 Subject: [PATCH] =?UTF-8?q?Syncfusion=20lizens=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KanSan/App.xaml.cs | 5 ++ KanSan/Baustelle.cs | 1 - KanSan/Kunden.cs | 3 ++ ... 20200213193512_InitialCommit.Designer.cs} | 51 ++++++++++++------- ...ate.cs => 20200213193512_InitialCommit.cs} | 28 +++++----- .../Migrations/KanSanContextModelSnapshot.cs | 47 ++++++++++------- KanSan/Model.cs | 6 +-- 7 files changed, 89 insertions(+), 52 deletions(-) rename KanSan/Migrations/{20200212120350_InitialCreate.Designer.cs => 20200213193512_InitialCommit.Designer.cs} (66%) rename KanSan/Migrations/{20200212120350_InitialCreate.cs => 20200213193512_InitialCommit.cs} (80%) diff --git a/KanSan/App.xaml.cs b/KanSan/App.xaml.cs index d128e5d..365a8e0 100644 --- a/KanSan/App.xaml.cs +++ b/KanSan/App.xaml.cs @@ -13,5 +13,10 @@ namespace KanSan /// public partial class App : Application { + public App() + { + Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjEwMDc1QDMxMzcyZTM0MmUzME9iTUUzZVRJSGpnYmNLdXg0cmpSMGF1SnZjcHhKN09MYUV6UlRRUWloTWs9"); + } + } } diff --git a/KanSan/Baustelle.cs b/KanSan/Baustelle.cs index c3d4a65..9858488 100644 --- a/KanSan/Baustelle.cs +++ b/KanSan/Baustelle.cs @@ -5,7 +5,6 @@ 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; } diff --git a/KanSan/Kunden.cs b/KanSan/Kunden.cs index 0542e14..3b83b6a 100644 --- a/KanSan/Kunden.cs +++ b/KanSan/Kunden.cs @@ -8,6 +8,9 @@ namespace KanSan 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 Baustellen { get; } = new List(); } diff --git a/KanSan/Migrations/20200212120350_InitialCreate.Designer.cs b/KanSan/Migrations/20200213193512_InitialCommit.Designer.cs similarity index 66% rename from KanSan/Migrations/20200212120350_InitialCreate.Designer.cs rename to KanSan/Migrations/20200213193512_InitialCommit.Designer.cs index 7559fc9..091e2ca 100644 --- a/KanSan/Migrations/20200212120350_InitialCreate.Designer.cs +++ b/KanSan/Migrations/20200213193512_InitialCommit.Designer.cs @@ -5,33 +5,36 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Migrations { [DbContext(typeof(KanSanContext))] - [Migration("20200212120350_InitialCreate")] - partial class InitialCreate + [Migration("20200213193512_InitialCommit")] + partial class InitialCommit { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.1.1"); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("KanSan.Baustelle", b => { b.Property("BaustelleID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("KundenID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Ort") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Strasse") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("BaustelleID"); @@ -44,13 +47,22 @@ namespace KanSan.Migrations { b.Property("KundenID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Nachname") - .HasColumnType("TEXT"); + .HasColumnType("text"); + + b.Property("Ort") + .HasColumnType("text"); + + b.Property("PLZ") + .HasColumnType("text"); + + b.Property("Strasse") + .HasColumnType("text"); b.Property("Vorname") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("KundenID"); @@ -61,13 +73,14 @@ namespace KanSan.Migrations { b.Property("LeistungsverzeichnisBaustelleID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("BaustelleID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("LeistungsverzeichnissID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.HasKey("LeistungsverzeichnisBaustelleID"); @@ -75,26 +88,26 @@ namespace KanSan.Migrations b.HasIndex("LeistungsverzeichnissID"); - b.ToTable("leistungsverzeichnisBaustelle"); + b.ToTable("LeistungsverzeichnisBaustelle"); }); modelBuilder.Entity("KanSan.Leistungsverzeichniss", b => { b.Property("LeistungsverzeichnissID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Position") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionBeschreibung") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionEinheit") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionEinheitspreis") - .HasColumnType("TEXT"); + .HasColumnType("numeric"); b.HasKey("LeistungsverzeichnissID"); diff --git a/KanSan/Migrations/20200212120350_InitialCreate.cs b/KanSan/Migrations/20200213193512_InitialCommit.cs similarity index 80% rename from KanSan/Migrations/20200212120350_InitialCreate.cs rename to KanSan/Migrations/20200213193512_InitialCommit.cs index e867cb8..7b1a857 100644 --- a/KanSan/Migrations/20200212120350_InitialCreate.cs +++ b/KanSan/Migrations/20200213193512_InitialCommit.cs @@ -1,9 +1,10 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Migrations { - public partial class InitialCreate : Migration + public partial class InitialCommit : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -13,7 +14,10 @@ namespace KanSan.Migrations { KundenID = table.Column(nullable: false), Vorname = table.Column(nullable: true), - Nachname = table.Column(nullable: true) + Nachname = table.Column(nullable: true), + Strasse = table.Column(nullable: true), + PLZ = table.Column(nullable: true), + Ort = table.Column(nullable: true) }, constraints: table => { @@ -56,25 +60,25 @@ namespace KanSan.Migrations }); migrationBuilder.CreateTable( - name: "leistungsverzeichnisBaustelle", + name: "LeistungsverzeichnisBaustelle", columns: table => new { LeistungsverzeichnisBaustelleID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), BaustelleID = table.Column(nullable: true), LeistungsverzeichnissID = table.Column(nullable: true) }, constraints: table => { - table.PrimaryKey("PK_leistungsverzeichnisBaustelle", x => x.LeistungsverzeichnisBaustelleID); + table.PrimaryKey("PK_LeistungsverzeichnisBaustelle", x => x.LeistungsverzeichnisBaustelleID); table.ForeignKey( - name: "FK_leistungsverzeichnisBaustelle_Baustellen_BaustelleID", + name: "FK_LeistungsverzeichnisBaustelle_Baustellen_BaustelleID", column: x => x.BaustelleID, principalTable: "Baustellen", principalColumn: "BaustelleID", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_leistungsverzeichnisBaustelle_Leistungsverzeichnisses_LeistungsverzeichnissID", + name: "FK_LeistungsverzeichnisBaustelle_Leistungsverzeichnisses_Leist~", column: x => x.LeistungsverzeichnissID, principalTable: "Leistungsverzeichnisses", principalColumn: "LeistungsverzeichnissID", @@ -87,20 +91,20 @@ namespace KanSan.Migrations column: "KundenID"); migrationBuilder.CreateIndex( - name: "IX_leistungsverzeichnisBaustelle_BaustelleID", - table: "leistungsverzeichnisBaustelle", + name: "IX_LeistungsverzeichnisBaustelle_BaustelleID", + table: "LeistungsverzeichnisBaustelle", column: "BaustelleID"); migrationBuilder.CreateIndex( - name: "IX_leistungsverzeichnisBaustelle_LeistungsverzeichnissID", - table: "leistungsverzeichnisBaustelle", + name: "IX_LeistungsverzeichnisBaustelle_LeistungsverzeichnissID", + table: "LeistungsverzeichnisBaustelle", column: "LeistungsverzeichnissID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "leistungsverzeichnisBaustelle"); + name: "LeistungsverzeichnisBaustelle"); migrationBuilder.DropTable( name: "Baustellen"); diff --git a/KanSan/Migrations/KanSanContextModelSnapshot.cs b/KanSan/Migrations/KanSanContextModelSnapshot.cs index d3e076f..8d36627 100644 --- a/KanSan/Migrations/KanSanContextModelSnapshot.cs +++ b/KanSan/Migrations/KanSanContextModelSnapshot.cs @@ -4,6 +4,7 @@ using KanSan; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Migrations { @@ -14,22 +15,24 @@ namespace KanSan.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.1.1"); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("KanSan.Baustelle", b => { b.Property("BaustelleID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("KundenID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Ort") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Strasse") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("BaustelleID"); @@ -42,13 +45,22 @@ namespace KanSan.Migrations { b.Property("KundenID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Nachname") - .HasColumnType("TEXT"); + .HasColumnType("text"); + + b.Property("Ort") + .HasColumnType("text"); + + b.Property("PLZ") + .HasColumnType("text"); + + b.Property("Strasse") + .HasColumnType("text"); b.Property("Vorname") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("KundenID"); @@ -59,13 +71,14 @@ namespace KanSan.Migrations { b.Property("LeistungsverzeichnisBaustelleID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("BaustelleID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("LeistungsverzeichnissID") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.HasKey("LeistungsverzeichnisBaustelleID"); @@ -73,26 +86,26 @@ namespace KanSan.Migrations b.HasIndex("LeistungsverzeichnissID"); - b.ToTable("leistungsverzeichnisBaustelle"); + b.ToTable("LeistungsverzeichnisBaustelle"); }); modelBuilder.Entity("KanSan.Leistungsverzeichniss", b => { b.Property("LeistungsverzeichnissID") .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.Property("Position") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionBeschreibung") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionEinheit") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PositionEinheitspreis") - .HasColumnType("TEXT"); + .HasColumnType("numeric"); b.HasKey("LeistungsverzeichnissID"); diff --git a/KanSan/Model.cs b/KanSan/Model.cs index 9dc252c..3ef64d1 100644 --- a/KanSan/Model.cs +++ b/KanSan/Model.cs @@ -12,13 +12,13 @@ namespace KanSan public DbSet Kunden { get; set; } public DbSet Leistungsverzeichnisses { get; set; } - public DbSet leistungsverzeichnisBaustelle { get; set; } + public DbSet LeistungsverzeichnisBaustelle { get; set; } public DbSet Baustellen { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) { - options.UseSqlite("Data Source=kanSan.db"); - //options.UseNpgsql("Host=localhost;Database=kanSan;Username=user;Password=pass"); + //options.UseSqlite("Data Source=kanSan.db"); + options.UseNpgsql("Host=localhost;Database=kanSan;Username=kansan;Password=kansan"); } /*