yavsc/src/Yavsc.Server/Models/Blog/BlogAttachedFile.cs

60 lines
1.4 KiB
C#
Raw Normal View History

2026-03-01 02:13:26 +00:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2026-06-10 00:23:17 +01:00
using Microsoft.EntityFrameworkCore;
2026-03-01 02:13:26 +00:00
namespace Yavsc.Models.Blog
{
public class UploadedFile
{
/// <summary>
/// File Identifier
/// </summary>
/// <value></value>
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Display(Name = "Identifiant du fichier")]
public long Id { get; set; }
/// <summary>
/// relative path to the file, relative to the poster space prefix
/// </summary>
/// <value></value>
public string Path { get; set; }
/// <summary>
/// Length
/// </summary> <summary>
///
/// </summary>
/// <value></value>
public long Length { get; set; }
/// <summary>
/// File Content type
/// </summary>
/// <value></value>
public string ContentType { get; set; }
}
2026-06-10 00:23:17 +01:00
[PrimaryKey(nameof(FileId), nameof(PostId))]
2026-03-01 02:13:26 +00:00
public class BlogAttachedFile
{
/// <summary>
2026-06-10 00:23:17 +01:00
/// File Id (part of composite key)
2026-03-01 02:13:26 +00:00
/// </summary>
/// <value></value>
public long FileId { get; set; }
[ForeignKey("FileId")]
public virtual UploadedFile File { get; set; }
/// <summary>
2026-06-10 00:23:17 +01:00
/// Post Id (part of composite key)
2026-03-01 02:13:26 +00:00
/// </summary>
/// <value></value>
public long PostId { get; set; }
[ForeignKey("PostId")]
public virtual BlogPost Post { get; set; }
}
}