Witam. Posiadam 3 tabele:
public DbSet<MachineReport> MachineReports { get; set; }
public DbSet<MachineModel> Machines { get; set; }
public DbSet<CustomerModel> Customers { get; set; }
public DbSet<ApplicationUser> ApplicationUsers { get; set; }
Element z MachineReports
jest przypisany do elementu z Machines
Element z Machines
jest przypisany do elementu z Customers
i teraz pojawia się problem, bo ApplicationUsers
to w zależności od ról "serwisanci", "klienci" lub "sprzedawcy".
- Do elementu
Customers
będzie przypisany 1 elementApplicationUsers
z rolą "sprzedawcy" - Do elementu
Customers
może być przypisanych wiele elementówApplicationUsers
z rolą "klienci" - Do elementu
Customers
może być przypisanych wiele elementówApplicationUsers
z rolą "serwisanci"
Nie mam pojęcia jak to ugryźć. Moje próby kończą się na błędzie podczasadd-migration
public class CustomerModel
{
public Guid Id { get; set; }
public string CompanyName { get; set; }
public virtual ICollection<ApplicationUser> Clients { get; set; }
public virtual ICollection<ApplicationUser> Servisants { get; set; }
public Guid? MerchantId { get; set; }
public virtual ApplicationUser Merchant { get; set; }
}
PM> add-migration update1
Build started...
Build succeeded.
Microsoft.EntityFrameworkCore.Model[10605]
There are multiple relationships between 'ApplicationUser' and 'CustomerModel' without configured foreign key properties. This will cause Entity Framework to create shadow properties on 'ApplicationUser' with names dependent on the discovery order.
An operation was scaffolded that may result in the loss of data. Please review the migration for accuracy.
To undo this action, use Remove-Migration.
PM>
Mógłbym prosić o podpowiedź?