I have a less than ideal data model that is something like this (a country can have no or exactly one central bank):
Table COUNTRY:
COUNTRY_ID: Guid
Table CENTRAL_BANK:
CENTRAL_BANK_ID: Guid
COUNTRY_ID: Guid
Of course it would be better if we head a CENTRAL_BANK_ID
in the COUNTRY
table, then it would probably work as intended.
But now we get something like:
class Country
{
public Guid CountryId { get; set; }
public virtual ICollection<CentralBank> CentralBanks { get; set; }
}
But what we want is of course:
class Country
{
public Guid CountryId { get; set; }
public virtual CentralBank? CentralBank { get; set; }
}
Is there some way to tell the EF Core Power Tools that the relationship is really 1:0..1 and not 1:N?