Use enumerations in EF models.

This commit is contained in:
2018-08-06 21:07:07 +01:00
parent b9aca7a804
commit e6378588f3
12 changed files with 1805 additions and 73 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class UseExistingEnumerations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder) { }
protected override void Down(MigrationBuilder migrationBuilder) { }
}
}

View File

@@ -199,17 +199,17 @@ namespace Cicm.Database.Migrations
b.Property<int>("CompanyId").HasColumnName("company_id").HasColumnType("int(11)");
b.Property<string>("LogoGuid").HasColumnName("logo_guid").HasColumnType("char(36)");
b.Property<string>("Guid").HasColumnName("logo_guid").HasColumnType("char(36)");
b.Property<int?>("Year").HasColumnName("year").HasColumnType("int(4)");
b.HasKey("Id", "CompanyId", "LogoGuid");
b.HasKey("Id", "CompanyId", "Guid");
b.HasIndex("CompanyId").HasName("idx_company_id");
b.HasIndex("Id").IsUnique().HasName("idx_id");
b.HasIndex("Guid").HasName("idx_guid");
b.HasIndex("LogoGuid").HasName("idx_guid");
b.HasIndex("Id").IsUnique().HasName("idx_id");
b.ToTable("company_logos");
});
@@ -938,7 +938,7 @@ namespace Cicm.Database.Migrations
modelBuilder.Entity("Cicm.Database.Models.CompanyDescriptions",
b =>
{
b.HasOne("Cicm.Database.Models.Companies", "Company").WithOne("CompanyDescriptions")
b.HasOne("Cicm.Database.Models.Companies", "Company").WithOne("Description")
.HasForeignKey("Cicm.Database.Models.CompanyDescriptions", "Id")
.HasConstraintName("fk_company_id").OnDelete(DeleteBehavior.Cascade);
});

View File

@@ -29,11 +29,11 @@ namespace Cicm.Database.Models
public string Province { get; set; }
public string PostalCode { get; set; }
public short? CountryId { get; set; }
public int Status { get; set; }
public CompanyStatus Status { get; set; }
public Iso31661Numeric Country { get; set; }
public Companies SoldTo { get; set; }
public CompanyDescriptions CompanyDescriptions { get; set; }
public CompanyDescriptions Description { get; set; }
public ICollection<CompanyLogos> CompanyLogos { get; set; }
public ICollection<Gpus> Gpus { get; set; }
public ICollection<Companies> InverseSoldToNavigation { get; set; }

View File

@@ -5,7 +5,7 @@
public int Id { get; set; }
public int CompanyId { get; set; }
public int? Year { get; set; }
public string LogoGuid { get; set; }
public string Guid { get; set; }
public Companies Company { get; set; }
}

View File

@@ -17,7 +17,7 @@ namespace Cicm.Database.Models
public int Id { get; set; }
public int CompanyId { get; set; }
public string Name { get; set; }
public int Type { get; set; }
public MachineType Type { get; set; }
public DateTime? Introduced { get; set; }
public int? FamilyId { get; set; }
public string Model { get; set; }

View File

@@ -3,8 +3,8 @@
public class MemoryByMachine
{
public int MachineId { get; set; }
public int Type { get; set; }
public int Usage { get; set; }
public MemoryType Type { get; set; }
public MemoryUsage Usage { get; set; }
public long? Size { get; set; }
public double? Speed { get; set; }
public long Id { get; set; }

View File

@@ -4,7 +4,7 @@
{
public int Id { get; set; }
public string Date { get; set; }
public int Type { get; set; }
public NewsType Type { get; set; }
public int AddedId { get; set; }
}
}

View File

@@ -5,7 +5,7 @@
public int Id { get; set; }
public int DbId { get; set; }
public string Date { get; set; }
public int Status { get; set; }
public StatusType Status { get; set; }
public int Trade { get; set; }
public int Boxed { get; set; }
public int Manuals { get; set; }

View File

@@ -5,7 +5,7 @@
public int Id { get; set; }
public int DbId { get; set; }
public string Date { get; set; }
public int Status { get; set; }
public StatusType Status { get; set; }
public int Trade { get; set; }
public int Boxed { get; set; }
public int Manuals { get; set; }

View File

@@ -3,8 +3,8 @@
public class StorageByMachine
{
public int MachineId { get; set; }
public int Type { get; set; }
public int Interface { get; set; }
public StorageType Type { get; set; }
public StorageInterface Interface { get; set; }
public long? Capacity { get; set; }
public long Id { get; set; }

View File

@@ -218,13 +218,13 @@ namespace Cicm.Database.Models
entity.Property(e => e.Text).HasColumnName("text").HasColumnType("text");
entity.HasOne(d => d.Company).WithOne(p => p.CompanyDescriptions)
.HasForeignKey<CompanyDescriptions>(d => d.Id).HasConstraintName("fk_company_id");
entity.HasOne(d => d.Company).WithOne(p => p.Description).HasForeignKey<CompanyDescriptions>(d => d.Id)
.HasConstraintName("fk_company_id");
});
modelBuilder.Entity<CompanyLogos>(entity =>
{
entity.HasKey(e => new {e.Id, e.CompanyId, e.LogoGuid});
entity.HasKey(e => new {e.Id, e.CompanyId, LogoGuid = e.Guid});
entity.ToTable("company_logos");
@@ -232,13 +232,13 @@ namespace Cicm.Database.Models
entity.HasIndex(e => e.Id).HasName("idx_id").IsUnique();
entity.HasIndex(e => e.LogoGuid).HasName("idx_guid");
entity.HasIndex(e => e.Guid).HasName("idx_guid");
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)").ValueGeneratedOnAdd();
entity.Property(e => e.CompanyId).HasColumnName("company_id").HasColumnType("int(11)");
entity.Property(e => e.LogoGuid).HasColumnName("logo_guid").HasColumnType("char(36)");
entity.Property(e => e.Guid).HasColumnName("logo_guid").HasColumnType("char(36)");
entity.Property(e => e.Year).HasColumnName("year").HasColumnType("int(4)");