Hi all,
Any idea why am I always getting originalValue as null?
I'm using LLBLGen Pro 5.10 and .NET8
using EduInspection.Data.EntityClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Collections;
namespace EduInspection.Core.Features.Auditing;
[DependencyInjectionInfo(typeof(SchoolGradeEntity), "AuditorToUse")]
[Serializable]
public class SchoolGradeAuditor() : AuditorBase
{
private enum AuditType
{
DeleteOfEntity = 1,
DirectDeleteOfEntities,
DirectUpdateOfEntities,
DereferenceOfRelatedEntity,
ReferenceOfRelatedEntity,
EntityFieldSet,
InsertOfNewEntity,
UpdateOfExistingEntity
}
private List<ActivityLogEntity> _auditInfoEntities = [];
public override void AuditEntityFieldSet(IEntityCore entity, int fieldIndex, object originalValue)
{
var primaryKeyFieldsValues = entity.PrimaryKeyFieldInfos.Select(x => entity.GetCurrentFieldValue(x.FieldIndex));
var logEntity = new ActivityLogEntity
{
EntityName = entity.LLBLGenProEntityName,
FieldName = entity.Fields.GetFieldNames()[fieldIndex],
OldValue = originalValue,
NewValue = entity.GetCurrentFieldValue(fieldIndex).ToString(),
ActionTypeIndex = (int)AuditType.EntityFieldSet,
DateCreatedUtc = DateTime.UtcNow,
};
_auditInfoEntities.Add(logEntity);
}
}