42 lines
1.6 KiB
C#
42 lines
1.6 KiB
C#
|
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
|
||
|
|
namespace GhostImageManager.Data;
|
||
|
|
|
||
|
|
public class AppDbContext : DbContext
|
||
|
|
{
|
||
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public DbSet<ManagedImage> ManagedImages => Set<ManagedImage>();
|
||
|
|
|
||
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||
|
|
{
|
||
|
|
modelBuilder.Entity<ManagedImage>(entity =>
|
||
|
|
{
|
||
|
|
entity.HasKey(e => e.Id);
|
||
|
|
entity.HasIndex(e => e.GhostImageUrl);
|
||
|
|
entity.HasIndex(e => e.GhostInstanceId);
|
||
|
|
entity.HasIndex(e => e.FileName);
|
||
|
|
entity.HasIndex(e => e.AuthorId);
|
||
|
|
entity.HasIndex(e => e.Theme);
|
||
|
|
entity.HasIndex(e => e.CaptureDate);
|
||
|
|
|
||
|
|
entity.Property(e => e.GhostImageUrl).HasMaxLength(2000);
|
||
|
|
entity.Property(e => e.RelativePath).HasMaxLength(1000);
|
||
|
|
entity.Property(e => e.FileName).HasMaxLength(500);
|
||
|
|
entity.Property(e => e.GhostInstanceId).HasMaxLength(100);
|
||
|
|
entity.Property(e => e.AuthorId).HasMaxLength(100);
|
||
|
|
entity.Property(e => e.AuthorName).HasMaxLength(200);
|
||
|
|
entity.Property(e => e.CameraMake).HasMaxLength(200);
|
||
|
|
entity.Property(e => e.CameraModel).HasMaxLength(200);
|
||
|
|
entity.Property(e => e.Lens).HasMaxLength(200);
|
||
|
|
entity.Property(e => e.Aperture).HasMaxLength(50);
|
||
|
|
entity.Property(e => e.ShutterSpeed).HasMaxLength(50);
|
||
|
|
entity.Property(e => e.Iso).HasMaxLength(50);
|
||
|
|
entity.Property(e => e.FocalLength).HasMaxLength(50);
|
||
|
|
entity.Property(e => e.Theme).HasMaxLength(500);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|