Files
WatchIt/WatchIt.Database/WatchIt.Database.Model/Account/AccountProfilePicture.cs

60 lines
1.5 KiB
C#
Raw Normal View History

2024-03-17 13:55:29 +01:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WatchIt.Database.Model.Account
{
public class AccountProfilePicture : IEntity<AccountProfilePicture>
{
#region PROPERTIES
public Guid Id { get; set; }
public byte[] Image { get; set; }
public string MimeType { get; set; }
2024-03-18 00:14:08 +01:00
public DateTime UploadDate { get; set; }
2024-03-17 13:55:29 +01:00
#endregion
#region NAVIGATION
public Account Account { get; set; }
#endregion
#region PUBLIC METHODS
static void IEntity<AccountProfilePicture>.Build(EntityTypeBuilder<AccountProfilePicture> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.Property(x => x.Image)
.HasMaxLength(-1)
.IsRequired();
builder.Property(x => x.MimeType)
.HasMaxLength(50)
.IsRequired();
builder.Property(x => x.UploadDate)
.IsRequired()
.HasDefaultValueSql("now()");
}
#endregion
}
}