Specifies Genres and Tags configurations

This commit is contained in:
BinaryAlley committed 2024-08-28 21:49:51 +03:00
1 parent 182c8aadb5
commit 46b646c9da
3 files changed
+53 -1

No files matched your search

@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="GenreDto"/> entity.
/// </summary>
public class GenreConfiguration : IEntityTypeConfiguration<GenreDto>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the <see cref="GenreDto"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<GenreDto> builder)
{
builder.ToTable("Genres");
builder.HasKey(genre => genre.Name);
builder.Property(genre => genre.Name).IsRequired().HasMaxLength(50);
}
#endregion
}
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="TagDto"/> entity.
/// </summary>
public class TagConfiguration : IEntityTypeConfiguration<TagDto>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the <see cref="TagDto"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<TagDto> builder)
{
builder.ToTable("Tags");
builder.HasKey(tag => tag.Name);
builder.Property(tag => tag.Name).IsRequired().HasMaxLength(50);
}
#endregion
}
@@ -55,4 +55,4 @@ public static class DataAccessLayerServices
}
}
#endregion
}
}