From 2c4ebc9dbcabd5ab30f45ca7de9e466008209a41 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 10 Jul 2018 14:58:02 +0300 Subject: [PATCH] Added maxvalues to EntityChange and EntityPropertyChange --- .../Volo/Abp/AuditLogging/EntityChangeConsts.cs | 9 +++++++++ .../AuditLogging/EntityPropertyChangeConsts.cs | 17 +++++++++++++++++ ...itLoggingtDbContextModelBuilderExtensions.cs | 12 ++++++------ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs create mode 100644 modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs new file mode 100644 index 0000000000..d19407cfa4 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.AuditLogging +{ + public class EntityChangeConsts + { + public const int MaxEntityTypeFullNameLength = 128; + + public const int MaxEntityIdLength = 128; + } +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs new file mode 100644 index 0000000000..141ea04ed4 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Volo.Abp.AuditLogging +{ + public class EntityPropertyChangeConsts + { + public const int MaxNewValueLength = 512; + + public const int MaxOriginalValueLength = 512; + + public const int MaxPropertyNameLength = 128; + + public const int MaxPropertyTypeFullNameLength = 64; + } +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs index 4cb576b805..cd2c7318e3 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs @@ -65,8 +65,8 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore b.ConfigureExtraProperties(); - b.Property(x => x.EntityTypeFullName).IsRequired().HasColumnName(nameof(EntityChange.EntityTypeFullName)); - b.Property(x => x.EntityId).IsRequired().HasColumnName(nameof(EntityChange.EntityId)); + b.Property(x => x.EntityTypeFullName).HasMaxLength(EntityChangeConsts.MaxEntityTypeFullNameLength).IsRequired().HasColumnName(nameof(EntityChange.EntityTypeFullName)); + b.Property(x => x.EntityId).HasMaxLength(EntityChangeConsts.MaxEntityIdLength).IsRequired().HasColumnName(nameof(EntityChange.EntityId)); b.Property(x => x.AuditLogId).IsRequired().HasColumnName(nameof(EntityChange.AuditLogId)); b.Property(x => x.ChangeTime).IsRequired().HasColumnName(nameof(EntityChange.ChangeTime)); b.Property(x => x.ChangeType).IsRequired().HasColumnName(nameof(EntityChange.ChangeType)); @@ -82,10 +82,10 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore { b.ToTable(tablePrefix + "EntityPropertyChanges", schema); - b.Property(x => x.NewValue).IsRequired().HasColumnName(nameof(EntityPropertyChange.NewValue)); - b.Property(x => x.PropertyName).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyName)); - b.Property(x => x.PropertyTypeFullName).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyTypeFullName)); - b.Property(x => x.OriginalValue).HasColumnName(nameof(EntityPropertyChange.OriginalValue)); + b.Property(x => x.NewValue).HasMaxLength(EntityPropertyChangeConsts.MaxNewValueLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.NewValue)); + b.Property(x => x.PropertyName).HasMaxLength(EntityPropertyChangeConsts.MaxPropertyNameLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyName)); + b.Property(x => x.PropertyTypeFullName).HasMaxLength(EntityPropertyChangeConsts.MaxPropertyTypeFullNameLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyTypeFullName)); + b.Property(x => x.OriginalValue).HasMaxLength(EntityPropertyChangeConsts.MaxOriginalValueLength).HasColumnName(nameof(EntityPropertyChange.OriginalValue)); b.HasIndex(x => new { x.EntityChangeId }); });