Open Closed

EntityPropertyChange For Audited Object Being Truncated and No way to override. #7597


User avatar
0
ndeol@woolworths.com.au created
  • ABP Framework version: v8.0.2
  • UI Type: Angular
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

This I abp implementation when saving Audit Porperty Changes. As in MongoDb Case I am adding custom Entity Change object which Is bigger as its in Sterilized object. But Implementation we currently have Truncate the Value before Audit Information is saved. There is no way to override it either. Can you explain how can I override **EntityPropertyChangeConsts.MaxNewValueLength ** , If not Then Any other way to set the value on NewValue as its protected Set.
[DisableAuditing] public class EntityPropertyChange : Entity<Guid>, IMultiTenant { public virtual Guid? TenantId { get; protected set; }

public virtual Guid EntityChangeId { get; protected set; }

public virtual string NewValue { get; protected set; }

public virtual string OriginalValue { get; protected set; }

public virtual string PropertyName { get; protected set; }

public virtual string PropertyTypeFullName { get; protected set; }

protected EntityPropertyChange()
{

}

public EntityPropertyChange(
    IGuidGenerator guidGenerator,
    Guid entityChangeId,
    EntityPropertyChangeInfo entityChangeInfo,
    Guid? tenantId = null)
{
    Id = guidGenerator.Create();
    TenantId = tenantId;
    EntityChangeId = entityChangeId;
    **NewValue = entityChangeInfo.NewValue.Truncate(EntityPropertyChangeConsts.MaxNewValueLength);**
    OriginalValue = entityChangeInfo.OriginalValue.Truncate(EntityPropertyChangeConsts.MaxOriginalValueLength);
    PropertyName = entityChangeInfo.PropertyName.TruncateFromBeginning(EntityPropertyChangeConsts.MaxPropertyNameLength);
    PropertyTypeFullName = entityChangeInfo.PropertyTypeFullName.TruncateFromBeginning(EntityPropertyChangeConsts.MaxPropertyTypeFullNameLength);
}

}


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    you can set MaxNewValueLength in the DomainShared module and add a new migrations file.

    public class ...DomainSharedModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            EntityPropertyChangeConsts.MaxNewValueLength = 10000
        }
    }
    
  • User Avatar
    0
    ndeol@woolworths.com.au created

    Thanks That worked

Made with ❤️ on ABP v9.0.0-preview. Updated on October 07, 2024, 08:52