This commit is contained in:
2025-10-27 17:39:18 -04:00
commit 31f723bea4
1579 changed files with 642409 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Prefab.Data.Entities;
namespace Prefab.Data.Configs
{
/// <summary>
/// Entity Framework Core configuration for the <see cref="AuditLogItem"/> entity.
/// </summary>
public class AuditLogItemConfig() : Prefab.Data.Configs.EntityConfig<AuditLogItem>(nameof(IPrefabDb.AuditLogItems))
{
/// <summary>
/// Configures the properties and relationships for the <see cref="AuditLogItem"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity type.</param>
public override void Configure(EntityTypeBuilder<AuditLogItem> builder)
{
builder.HasKey(e => e.Id);
builder.Property(e => e.Property)
.HasMaxLength(Rules.PropertyMaxLength)
.IsRequired();
builder.Property(e => e.OldValue)
.HasMaxLength(Rules.ValueMaxLength);
builder.Property(e => e.NewValue)
.HasMaxLength(Rules.ValueMaxLength);
builder.HasOne(e => e.AuditLog)
.WithMany(a => a.Items)
.HasForeignKey(e => e.AuditLogId)
.OnDelete(DeleteBehavior.Cascade);
}
/// <summary>
/// Validation rules and settings for <see cref="AuditLogItem"/> properties.
/// </summary>
public static class Rules
{
/// <summary>Maximum length for the property name.</summary>
public const int PropertyMaxLength = 100;
/// <summary>Maximum length for the value fields.</summary>
public const int ValueMaxLength = 1000;
}
}
}