Base solution for your next web application
Open Closed

Issues with Fully Audited Association classes #2905


User avatar
0
codenewa created

I have an entity Location which is associated to the Tenant entity via association class TenantLocation. I need to track changes to TenantLocation, so I have set it to inherit from FullAuditedEntity.

Tenant has a property IList<TenantLocation> TenantLocations.

<ins>Issue 1</ins>: When I add a TenantLocation, the CreatorId is not populated for the TenantLocation Record.

<ins>Issue 2</ins>: Unless I go through a IRepository<TenantLocation>, I cannot remove a tenant location. When I attempt that I get an error: <span style="color:#FF0000">"The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted."</span>. Seems like I have to update the Association record one by one. So, when I use the repository, the error goes away but it does not populate DeleterUserId.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think this is the same problem, right ? <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/123">https://github.com/aspnetzero/aspnet-ze ... issues/123</a>