Refactoring, database structure changed
This commit is contained in:
30
WatchIt.Database/Configuration/ImageEntityConfiguration.cs
Normal file
30
WatchIt.Database/Configuration/ImageEntityConfiguration.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model;
|
||||
|
||||
namespace WatchIt.Database.Configuration;
|
||||
|
||||
public abstract class ImageEntityConfiguration<T> : IEntityTypeConfiguration<T> where T : class, IImageEntity
|
||||
{
|
||||
#region PUBLIC METHODS
|
||||
|
||||
public virtual void Configure(EntityTypeBuilder<T> builder)
|
||||
{
|
||||
// Image
|
||||
builder.Property(x => x.Image)
|
||||
.HasMaxLength(-1)
|
||||
.IsRequired();
|
||||
|
||||
// MimeType
|
||||
builder.Property(x => x.MimeType)
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
// UploadDate
|
||||
builder.Property(x => x.UploadDate)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("now()");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user