using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Weiferl.Databas.EF.Models; namespace Weiferl.Databas.EF; public partial class HardwareShopContext : DbContext { public HardwareShopContext() { } public HardwareShopContext(DbContextOptions options) : base(options) { } public virtual DbSet User { get; set; } 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", 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); }