using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Yavsc.Models.Blog { public class UploadedFile { /// /// File Identifier /// /// [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Display(Name = "Identifiant du fichier")] public long Id { get; set; } /// /// relative path to the file, relative to the poster space prefix /// /// public string Path { get; set; } /// /// Length /// /// /// /// public long Length { get; set; } /// /// File Content type /// /// public string ContentType { get; set; } } [PrimaryKey(nameof(FileId), nameof(PostId))] public class BlogAttachedFile { /// /// File Id (part of composite key) /// /// public long FileId { get; set; } [ForeignKey("FileId")] public virtual UploadedFile File { get; set; } /// /// Post Id (part of composite key) /// /// public long PostId { get; set; } [ForeignKey("PostId")] public virtual BlogPost Post { get; set; } } }