Reputation: 760
I'm adding Audit.NET/EF to a legacy DB-first project. (It uses an edmx file built from the database schema to generate the domain model.)
The DB has a many-to-many relationship between table A and table B modeled as usual with a linking table A_B. The domain model generated however doesn't have an A_B class. Instead, A has a container of Bs, and B has a container of As.
I'm finding that changes to the associations between A and B are not being seen by Audit.NET. (It does see the changes to A fields or B fields).
Am I missing something? Or is this simply not possible in Audit.NET?
Upvotes: 2
Views: 448
Reputation: 13114
Please check the issue #78
You need to set the IncludeIndependantAssociations
setting to true, to include the independant associations (many-to-many relations without a join entity):
Audit.EntityFramework.Configuration.Setup()
.ForAnyContext(cfg => cfg
.IncludeIndependantAssociations());
Note they are logged in a different property of the event output on EntityFrameworkEvent.Associations
Audit.Core.Configuration.AddOnCreatedAction(scope =>
{
var associations = scope.GetEntityFrameworkEvent().Associations;
// ...
});
Upvotes: 2