Open
Description
When adding an entity to a collection property of another entity (representing a 1-to-many relationship mapped by EF Core) and attempting to save changes, the following error occurs:
Finbuckle.MultiTenant.MultiTenantException : 1 modified entities with Tenant Id not set.
Is this expected? This used to work but something changed (in my code) but I have no clue what it could be.
The workaround is to add it through the DbContext.
Is there some condition for this to work?
This is the method I am calling on my entity:
public Device AddNetworkInterfaceController(Guid ipAddressId, string? macAddress, string? name, string? description)
{
var deviceNetowrkCard = new NetworkInterfaceController(this.Id, ipAddressId, macAddress, name, description);
NetworkInterfaceControllers.Add(deviceNetowrkCard);
return this;
}
and after that I call SaveChangesAsync
. When debugging EnforceMultiTenant
I can see that it is this NIC entity which is in the notSetModified
List.