2023-07-08 19:43:36 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-07-08 20:13:37 +02:00
|
|
|
|
using Weiferl.Databas.EF.Models;
|
2023-07-08 19:43:36 +02:00
|
|
|
|
|
2023-07-08 20:13:37 +02:00
|
|
|
|
namespace Weiferl.Databas.EF;
|
2023-07-08 19:43:36 +02:00
|
|
|
|
|
|
|
|
|
public partial class HardwareShopContext : DbContext
|
|
|
|
|
{
|
|
|
|
|
public HardwareShopContext()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HardwareShopContext(DbContextOptions<HardwareShopContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-08 20:13:37 +02:00
|
|
|
|
public virtual DbSet<User> User { get; set; }
|
2023-07-08 19:43:36 +02:00
|
|
|
|
public virtual DbSet<Cpu> Cpu { get; set; }
|
|
|
|
|
public virtual DbSet<Festplatten> Festplatten { get; set; }
|
|
|
|
|
public virtual DbSet<Grafikkarten> Grafikkarten { get; set; }
|
|
|
|
|
public virtual DbSet<Hersteller> Hersteller { get; set; }
|
|
|
|
|
public virtual DbSet<Kategorie> Kategorie { get; set; }
|
|
|
|
|
public virtual DbSet<Mainboard> Mainboard { get; set; }
|
|
|
|
|
public virtual DbSet<Ram> Ram { get; set; }
|
|
|
|
|
|
2023-07-08 20:13:37 +02:00
|
|
|
|
|
2023-07-08 19:43:36 +02:00
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
2023-07-08 20:13:37 +02:00
|
|
|
|
=> optionsBuilder.UseMySql("server=192.168.0.252;port=3306;database=hardware_shop;uid=root;pwd=op3iv2dbym", ServerVersion.Parse("10.11.4-mariadb"));
|
2023-07-08 19:43:36 +02:00
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder
|
|
|
|
|
.UseCollation("utf8mb3_general_ci")
|
|
|
|
|
.HasCharSet("utf8mb3");
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Cpu>(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<Festplatten>(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<Grafikkarten>(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<Hersteller>(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<Kategorie>(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<Mainboard>(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<Ram>(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);
|
|
|
|
|
}
|