From 913018a20a051c7d91394ae2bc6f3d4f762ce34c Mon Sep 17 00:00:00 2001 From: Marcus Ferl Date: Sat, 8 Jul 2023 19:43:36 +0200 Subject: [PATCH] Add project files. --- Weiferl.Databas.EF.sln | 25 +++ Weiferl.Databas.EF/HardwareShopContext.dgml | 178 ++++++++++++++++++ Weiferl.Databas.EF/Models/Cpu.cs | 23 +++ Weiferl.Databas.EF/Models/Festplatten.cs | 19 ++ Weiferl.Databas.EF/Models/Grafikkarten.cs | 19 ++ .../Models/HardwareShopContext.cs | 168 +++++++++++++++++ Weiferl.Databas.EF/Models/Hersteller.cs | 11 ++ Weiferl.Databas.EF/Models/Kategorie.cs | 11 ++ Weiferl.Databas.EF/Models/Mainboard.cs | 21 +++ Weiferl.Databas.EF/Models/Ram.cs | 21 +++ Weiferl.Databas.EF/Weiferl.Databas.EF.csproj | 55 ++++++ 11 files changed, 551 insertions(+) create mode 100644 Weiferl.Databas.EF.sln create mode 100644 Weiferl.Databas.EF/HardwareShopContext.dgml create mode 100644 Weiferl.Databas.EF/Models/Cpu.cs create mode 100644 Weiferl.Databas.EF/Models/Festplatten.cs create mode 100644 Weiferl.Databas.EF/Models/Grafikkarten.cs create mode 100644 Weiferl.Databas.EF/Models/HardwareShopContext.cs create mode 100644 Weiferl.Databas.EF/Models/Hersteller.cs create mode 100644 Weiferl.Databas.EF/Models/Kategorie.cs create mode 100644 Weiferl.Databas.EF/Models/Mainboard.cs create mode 100644 Weiferl.Databas.EF/Models/Ram.cs create mode 100644 Weiferl.Databas.EF/Weiferl.Databas.EF.csproj diff --git a/Weiferl.Databas.EF.sln b/Weiferl.Databas.EF.sln new file mode 100644 index 0000000..28f7737 --- /dev/null +++ b/Weiferl.Databas.EF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weiferl.Databas.EF", "Weiferl.Databas.EF\Weiferl.Databas.EF.csproj", "{E87E3BA2-3FCB-48BC-B3F3-634C6C962AB8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E87E3BA2-3FCB-48BC-B3F3-634C6C962AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E87E3BA2-3FCB-48BC-B3F3-634C6C962AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E87E3BA2-3FCB-48BC-B3F3-634C6C962AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E87E3BA2-3FCB-48BC-B3F3-634C6C962AB8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {569C8BC9-73F7-4EAF-9461-AAC63B64CD90} + EndGlobalSection +EndGlobal diff --git a/Weiferl.Databas.EF/HardwareShopContext.dgml b/Weiferl.Databas.EF/HardwareShopContext.dgml new file mode 100644 index 0000000..44f9649 --- /dev/null +++ b/Weiferl.Databas.EF/HardwareShopContext.dgml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Weiferl.Databas.EF/Models/Cpu.cs b/Weiferl.Databas.EF/Models/Cpu.cs new file mode 100644 index 0000000..147037a --- /dev/null +++ b/Weiferl.Databas.EF/Models/Cpu.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Cpu +{ + public int CpuId { get; set; } + + public string? KatName { get; set; } + + public string? Hersteller { get; set; } + + public string? Modell { get; set; } + + public string? Sockel { get; set; } + + public int? Kerne { get; set; } + + public int? Threads { get; set; } + + public decimal? Preis { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/Festplatten.cs b/Weiferl.Databas.EF/Models/Festplatten.cs new file mode 100644 index 0000000..9f7319e --- /dev/null +++ b/Weiferl.Databas.EF/Models/Festplatten.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Festplatten +{ + public int FestpId { get; set; } + + public string? KatName { get; set; } + + public string? Hersteller { get; set; } + + public string? Modell { get; set; } + + public int? Größe { get; set; } + + public decimal? Preis { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/Grafikkarten.cs b/Weiferl.Databas.EF/Models/Grafikkarten.cs new file mode 100644 index 0000000..2f79542 --- /dev/null +++ b/Weiferl.Databas.EF/Models/Grafikkarten.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Grafikkarten +{ + public int GraId { get; set; } + + public string? KatName { get; set; } + + public string? Modell { get; set; } + + public string? Hersteller { get; set; } + + public string? Chip { get; set; } + + public decimal? Preis { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/HardwareShopContext.cs b/Weiferl.Databas.EF/Models/HardwareShopContext.cs new file mode 100644 index 0000000..491191e --- /dev/null +++ b/Weiferl.Databas.EF/Models/HardwareShopContext.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace Weiferl.Databas.EF.Models; + +public partial class HardwareShopContext : DbContext +{ + public HardwareShopContext() + { + } + + public HardwareShopContext(DbContextOptions options) + : base(options) + { + } + + + public virtual DbSet Cpu { get; set; } + + public virtual DbSet Festplatten { get; set; } + + public virtual DbSet Grafikkarten { get; set; } + + public virtual DbSet Hersteller { get; set; } + + public virtual DbSet Kategorie { get; set; } + + public virtual DbSet Mainboard { get; set; } + + public virtual DbSet Ram { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseMySql("server=192.168.0.252;port=3306;database=hardware_shop;uid=root;pwd=op3iv2dbym", Microsoft.EntityFrameworkCore.ServerVersion.Parse("10.11.4-mariadb")); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder + .UseCollation("utf8mb3_general_ci") + .HasCharSet("utf8mb3"); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CpuId).HasName("PRIMARY"); + + entity.ToTable("cpus"); + + entity.Property(e => e.CpuId) + .HasColumnType("int(11)") + .HasColumnName("Cpu_ID"); + entity.Property(e => e.Hersteller).HasMaxLength(10); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + entity.Property(e => e.Kerne).HasColumnType("int(11)"); + entity.Property(e => e.Modell).HasMaxLength(50); + entity.Property(e => e.Preis).HasPrecision(8, 2); + entity.Property(e => e.Sockel).HasMaxLength(50); + entity.Property(e => e.Threads).HasColumnType("int(11)"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.FestpId).HasName("PRIMARY"); + + entity.ToTable("festplatten"); + + entity.Property(e => e.FestpId) + .HasColumnType("int(11)") + .HasColumnName("Festp_ID"); + entity.Property(e => e.Größe).HasColumnType("int(11)"); + entity.Property(e => e.Hersteller).HasMaxLength(100); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + entity.Property(e => e.Modell).HasMaxLength(100); + entity.Property(e => e.Preis).HasPrecision(8, 2); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.GraId).HasName("PRIMARY"); + + entity.ToTable("grafikkarten"); + + entity.Property(e => e.GraId) + .HasColumnType("int(11)") + .HasColumnName("Gra_ID"); + entity.Property(e => e.Chip).HasMaxLength(10); + entity.Property(e => e.Hersteller).HasMaxLength(100); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + entity.Property(e => e.Modell).HasMaxLength(100); + entity.Property(e => e.Preis).HasPrecision(8, 2); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.HerId).HasName("PRIMARY"); + + entity.ToTable("hersteller"); + + entity.Property(e => e.HerId) + .HasColumnType("int(11)") + .HasColumnName("Her_ID"); + entity.Property(e => e.Hersteller1) + .HasMaxLength(100) + .HasColumnName("Hersteller"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.KatId).HasName("PRIMARY"); + + entity.ToTable("kategorie"); + + entity.Property(e => e.KatId) + .HasColumnType("int(11)") + .HasColumnName("Kat_ID"); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.MainId).HasName("PRIMARY"); + + entity.ToTable("mainboard"); + + entity.Property(e => e.MainId) + .HasColumnType("int(11)") + .HasColumnName("Main_ID"); + entity.Property(e => e.Formfaktor).HasMaxLength(10); + entity.Property(e => e.Hersteller).HasMaxLength(50); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + entity.Property(e => e.Modell).HasMaxLength(50); + entity.Property(e => e.Preis).HasPrecision(8, 2); + entity.Property(e => e.Sockel).HasMaxLength(20); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.RamId).HasName("PRIMARY"); + + entity.ToTable("ram"); + + entity.Property(e => e.RamId) + .HasColumnType("int(11)") + .HasColumnName("Ram_ID"); + entity.Property(e => e.Größe).HasColumnType("int(11)"); + entity.Property(e => e.Hersteller).HasMaxLength(50); + entity.Property(e => e.KatName) + .HasMaxLength(50) + .HasColumnName("Kat_Name"); + entity.Property(e => e.Mhz).HasColumnType("int(11)"); + entity.Property(e => e.Modell).HasMaxLength(50); + entity.Property(e => e.Preis).HasPrecision(8, 2); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/Weiferl.Databas.EF/Models/Hersteller.cs b/Weiferl.Databas.EF/Models/Hersteller.cs new file mode 100644 index 0000000..e889ee0 --- /dev/null +++ b/Weiferl.Databas.EF/Models/Hersteller.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Hersteller +{ + public int HerId { get; set; } + + public string? Hersteller1 { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/Kategorie.cs b/Weiferl.Databas.EF/Models/Kategorie.cs new file mode 100644 index 0000000..11af10e --- /dev/null +++ b/Weiferl.Databas.EF/Models/Kategorie.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Kategorie +{ + public int KatId { get; set; } + + public string? KatName { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/Mainboard.cs b/Weiferl.Databas.EF/Models/Mainboard.cs new file mode 100644 index 0000000..51766df --- /dev/null +++ b/Weiferl.Databas.EF/Models/Mainboard.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Mainboard +{ + public int MainId { get; set; } + + public string? KatName { get; set; } + + public string? Hersteller { get; set; } + + public string? Modell { get; set; } + + public string? Sockel { get; set; } + + public string? Formfaktor { get; set; } + + public decimal? Preis { get; set; } +} diff --git a/Weiferl.Databas.EF/Models/Ram.cs b/Weiferl.Databas.EF/Models/Ram.cs new file mode 100644 index 0000000..87ac6fe --- /dev/null +++ b/Weiferl.Databas.EF/Models/Ram.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Weiferl.Databas.EF.Models; + +public partial class Ram +{ + public int RamId { get; set; } + + public string? KatName { get; set; } + + public string? Hersteller { get; set; } + + public string? Modell { get; set; } + + public int? Mhz { get; set; } + + public int? Größe { get; set; } + + public decimal? Preis { get; set; } +} diff --git a/Weiferl.Databas.EF/Weiferl.Databas.EF.csproj b/Weiferl.Databas.EF/Weiferl.Databas.EF.csproj new file mode 100644 index 0000000..f299eaa --- /dev/null +++ b/Weiferl.Databas.EF/Weiferl.Databas.EF.csproj @@ -0,0 +1,55 @@ + + + + net7.0 + enable + enable + True + Weiferl Database Ef + 1.0.1 + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + $(VersionMajor) + $(VersionMinor) + $(VersionPatch) + $(Major).$(Minor).$(Patch) + + + + + 1 + 0 + 0 + + + $(VersionPatch + 1) + $(Minor + 1) + $(Major + 1) + + + + $(VersionPrefix) + + + +