169 lines
5.7 KiB
C#
169 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Weiferl.Databas.EF.Models;
|
|
|
|
public partial class HardwareShopContext : DbContext
|
|
{
|
|
public HardwareShopContext()
|
|
{
|
|
}
|
|
|
|
public HardwareShopContext(DbContextOptions<HardwareShopContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
|
|
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; }
|
|
|
|
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<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);
|
|
}
|