AuditDereferenceOfRelatedEntity

Posts   
 
    
LukeO
User
Posts: 58
Joined: 23-Jul-2007
# Posted on: 05-Feb-2008 00:46:46   

This issue is about the "de"referencing of an entity as recorded by the auditor. My other issue about Referencing still stands.

I'm using the this code:

[Test] public void TestAuditOfDereferenceOfEntity() { // Make parent entity TestTableParent entityParent1 = new TestTableParent(); TestTableParent entityParent2 = new TestTableParent(); entityParent1.Data = "TestParent1"; entityParent2.Data = "TestParent2";

    // Save parent entities so that we have an ID
    _adapter.SaveEntity(entityParent1, true);
    _adapter.SaveEntity(entityParent2, true);

    // Make sure they got saved
    Assert.Greater(entityParent1.Id, 0);
    Assert.Greater(entityParent2.Id, 0);

    // Make child entity
    TestTableChild entityChild = new TestTableChild();
    entityChild.Data = "TestChild";

    // Now lets reference the child to parent1
    //entityParent1.TestTableChild.Add(entityChild);
    entityChild.TestTableParent = entityParent1;

    // Save child enitty
    _adapter.SaveEntity(entityChild, true);
     Assert.Greater(entityChild.Id, 0);

   // THE TEST: Now let's change the reference from parent1 to parent2
   //entityChild.TestTableParent = entityParent2;
   //_adapter.SaveEntity(entityChild);

}

Ok.

Notice the last two lines above (commented out). I set up the AuditInfo table just like the sample provided in the download section.

This gives the following set of records in this order. The numbers are the enum values also the same as the example (8 = Insert new entity, 5 = Reference of entity) TestTableParentEntity 8 TestTableParentEntity 8 TestTableChildEntity 5 TestTableChildEntity 8

This so far makes sense. Now when I "UN"comment the last two lines and re-run I get this

TestTableParentEntity 8 TestTableParentEntity 8 TestTableChildEntity 5 TestTableChildEntity 8 TestTableChildEntity 4 TestTableChildEntity 4 TestTableChildEntity 5

This would make sense if there was only ONE dereference record but there are two.

Any thoughts?

-Luke

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 05-Feb-2008 12:45:45   

Have you assigned the Auditor to both entities or to only one of them?

LukeO
User
Posts: 58
Joined: 23-Jul-2007
# Posted on: 05-Feb-2008 17:49:03   

I'm using dependency injection and haven't specified anything further.

Walaa wrote:

Have you assigned the Auditor to both entities or to only one of them?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 06-Feb-2008 15:19:25   

Would you please attach the Auditor class?