LLBLGen Framework 5.7/Adapter
Why in AuditDereferenceOfRelatedEntity is the related entity property not null? Take this code where there is a 1:m between ClaimPortEntity and ClaimGradeEntity. The first Assert passes, in AuditReferenceOfRelatedEntity the method is called after the reference is set. The second Assert fails, in AuditDereferenceOfRelatedEntity the related entity is still present. What is the logic behind that, I'd have expected the related entity to be already cleared as the name of the method is AuditDereferenceOfRelatedEntity , and not AuditDereferencingOfRelatedEntity
[Test]
public void Unset()
{
var claimPort = new ClaimPortEntity();
var grade = new ClaimGradeEntity();
claimPort.AuditorToUse = new TestAuditor();
grade.AuditorToUse = new TestAuditor();
claimPort.ClaimGrades.Add(grade);
claimPort.ClaimGrades.Remove(grade);
}
class TestAuditor : IAuditor
{
public void AuditEntityFieldGet(IEntityCore entity, int fieldIndex)
{
}
public void AuditEntityFieldSet(IEntityCore entity, int fieldIndex, object originalValue)
{
throw new NotImplementedException();
}
public void AuditDereferenceOfRelatedEntity(IEntityCore entity, IEntityCore relatedEntity, string mappedFieldName)
{
Debug.Assert(((ClaimGradeEntity)entity).ClaimPort == null);
}
public void AuditReferenceOfRelatedEntity(IEntityCore entity, IEntityCore relatedEntity, string mappedFieldName)
{
Debug.Assert(((ClaimGradeEntity)entity).ClaimPort != null);
}