mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Re-do company descriptions.
This commit is contained in:
@@ -68,15 +68,15 @@ namespace Cicm.Database.Models
|
||||
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
[DisplayName("Sold to")]
|
||||
public virtual Company SoldTo { get; set; }
|
||||
public virtual CompanyDescription Description { get; set; }
|
||||
public virtual ICollection<CompanyLogo> Logos { get; set; }
|
||||
public virtual ICollection<Gpu> Gpus { get; set; }
|
||||
public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
|
||||
public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual ICollection<Processor> Processors { get; set; }
|
||||
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||
public virtual Company SoldTo { get; set; }
|
||||
public virtual ICollection<CompanyDescription> Descriptions { get; set; }
|
||||
public virtual ICollection<CompanyLogo> Logos { get; set; }
|
||||
public virtual ICollection<Gpu> Gpus { get; set; }
|
||||
public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
|
||||
public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual ICollection<Processor> Processors { get; set; }
|
||||
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||
public virtual CompanyLogo LastLogo =>
|
||||
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||
|
||||
@@ -92,5 +92,8 @@ namespace Cicm.Database.Models
|
||||
? ""
|
||||
: "Unknown"
|
||||
: Sold.Value.ToShortDateString();
|
||||
|
||||
[NotMapped]
|
||||
public CompanyDescription Description => Descriptions.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
@@ -70,12 +70,11 @@ namespace Cicm.Database.Models
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if(!optionsBuilder.IsConfigured)
|
||||
{
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||
optionsBuilder.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm");
|
||||
optionsBuilder.UseLazyLoadingProxies();
|
||||
}
|
||||
if(optionsBuilder.IsConfigured) return;
|
||||
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||
optionsBuilder.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm");
|
||||
optionsBuilder.UseLazyLoadingProxies();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
@@ -238,23 +237,7 @@ namespace Cicm.Database.Models
|
||||
.HasConstraintName("fk_companies_sold_to");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<CompanyDescription>(entity =>
|
||||
{
|
||||
entity.ToTable("company_descriptions");
|
||||
|
||||
entity.HasIndex(e => e.CompanyId).HasName("idx_company_id");
|
||||
|
||||
entity.HasIndex(e => e.Text).HasName("idx_text");
|
||||
|
||||
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.Text).HasColumnName("text").HasColumnType("text");
|
||||
|
||||
entity.HasOne(d => d.Company).WithOne(p => p.Description).HasForeignKey<CompanyDescription>(d => d.Id)
|
||||
.HasConstraintName("fk_company_id");
|
||||
});
|
||||
modelBuilder.Entity<CompanyDescription>().HasIndex(e => e.Text).ForMySqlIsFullText();
|
||||
|
||||
modelBuilder.Entity<CompanyLogo>(entity =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user