Add photos to database.

This commit is contained in:
2019-05-27 03:17:11 +01:00
parent 9a1e00cbee
commit c6f7a6be69
8 changed files with 4137 additions and 801 deletions

View File

@@ -1,6 +1,10 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
namespace Cicm.Database.Models
{
public class ApplicationUser : IdentityUser { }
public class ApplicationUser : IdentityUser
{
public virtual ICollection<MachinePhoto> Photos { get; set; }
}
}

View File

@@ -68,6 +68,7 @@ namespace Cicm.Database.Models
public virtual ICollection<ProcessorsByMachine> Processors { get; set; }
public virtual ICollection<SoundByMachine> Sound { get; set; }
public virtual ICollection<StorageByMachine> Storage { get; set; }
public virtual ICollection<MachinePhoto> Photos { get; set; }
[NotMapped]
[DisplayName("Introduced")]

View File

@@ -0,0 +1,74 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models
{
public class MachinePhoto : BaseModel<Guid>
{
public string Author { get; set; }
[DisplayName("Camera manufacturer")]
public string CameraManufacturer { get; set; }
[DisplayName("Camera model")]
public string CameraModel { get; set; }
[DisplayName("Color space")]
public string ColorSpace { get; set; }
[DisplayName("User comments")]
public string Comments { get; set; }
public string Contrast { get; set; }
[DisplayName("Date and time of digitizing")]
public DateTime? CreationDate { get; set; }
[DisplayName("Digital zoom ratio")]
public double? DigitalZoomRatio { get; set; }
[DisplayName("Exif version")]
public string ExifVersion { get; set; }
[DisplayName("Exposure time")]
public double? Exposure { get; set; }
[DisplayName("Exposure mode")]
public string ExposureMethod { get; set; }
[DisplayName("Exposure Program")]
public string ExposureProgram { get; set; }
public string Flash { get; set; }
[DisplayName("F-number")]
public int? Focal { get; set; }
[DisplayName("Lens focal length")]
public int? FocalLength { get; set; }
[DisplayName("Focal length in 35 mm film")]
public string FocalLengthEquivalent { get; set; }
[DisplayName("Horizontal resolution")]
public int? HorizontalResolution { get; set; }
[DisplayName("ISO speed rating")]
public int? IsoRating { get; set; }
[DisplayName("Lens used")]
public string Lens { get; set; }
public string License { get; set; }
[DisplayName("Light source")]
public string LightSource { get; set; }
[DisplayName("Metering mode")]
public string MeteringMode { get; set; }
public string Orientation { get; set; }
[DisplayName("Pixel composition")]
public string PixelComposition { get; set; }
public string Saturation { get; set; }
[DisplayName("Scene capture type")]
public string SceneCaptureType { get; set; }
[DisplayName("Scene control")]
public string SceneControl { get; set; }
[DisplayName("Sensing method")]
public string SensingMethod { get; set; }
public string Sharpness { get; set; }
[DisplayName("Software used")]
public string SoftwareUsed { get; set; }
[DisplayName("Subject distance range")]
public string SubjectDistanceRange { get; set; }
[Timestamp]
public DateTime UploadDate { get; set; }
[DisplayName("Vertical resolution")]
public int? VerticalResolution { get; set; }
[DisplayName("White balance")]
public string WhiteBalance { get; set; }
public virtual ApplicationUser User { get; set; }
public virtual Machine Machine { get; set; }
}
}

View File

@@ -54,6 +54,7 @@ namespace Cicm.Database.Models
public virtual DbSet<Log> Log { get; set; }
public virtual DbSet<MachineFamily> MachineFamilies { get; set; }
public virtual DbSet<Machine> Machines { get; set; }
public virtual DbSet<MachinePhoto> MachinePhotos { get; set; }
public virtual DbSet<MemoryByMachine> MemoryByMachine { get; set; }
public virtual DbSet<MoneyDonation> MoneyDonations { get; set; }
public virtual DbSet<News> News { get; set; }
@@ -479,6 +480,81 @@ namespace Cicm.Database.Models
.HasConstraintName("fk_machines_family");
});
modelBuilder.Entity<MachinePhoto>(entity =>
{
entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.CameraManufacturer);
entity.HasIndex(e => e.CameraModel);
entity.HasIndex(e => e.ColorSpace);
entity.HasIndex(e => e.Comments);
entity.HasIndex(e => e.Contrast);
entity.HasIndex(e => e.CreationDate);
entity.HasIndex(e => e.DigitalZoomRatio);
entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.Exposure);
entity.HasIndex(e => e.ExposureMethod);
entity.HasIndex(e => e.ExposureProgram);
entity.HasIndex(e => e.Flash);
entity.HasIndex(e => e.Focal);
entity.HasIndex(e => e.FocalLength);
entity.HasIndex(e => e.FocalLengthEquivalent);
entity.HasIndex(e => e.HorizontalResolution);
entity.HasIndex(e => e.IsoRating);
entity.HasIndex(e => e.Lens);
entity.HasIndex(e => e.License);
entity.HasIndex(e => e.LightSource);
entity.HasIndex(e => e.MeteringMode);
entity.HasIndex(e => e.Orientation);
entity.HasIndex(e => e.PixelComposition);
entity.HasIndex(e => e.Saturation);
entity.HasIndex(e => e.SceneCaptureType);
entity.HasIndex(e => e.SceneControl);
entity.HasIndex(e => e.SensingMethod);
entity.HasIndex(e => e.Sharpness);
entity.HasIndex(e => e.SoftwareUsed);
entity.HasIndex(e => e.SubjectDistanceRange);
entity.HasIndex(e => e.UploadDate);
entity.HasIndex(e => e.VerticalResolution);
entity.HasIndex(e => e.WhiteBalance);
entity.HasOne(d => d.Machine).WithMany(p => p.Photos).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User).WithMany(p => p.Photos).OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<MemoryByMachine>(entity =>
{
entity.ToTable("memory_by_machine");