I have 3 different tables, Customer, Vehicle, Contact.
The customer and vehicle tables share the common key ReferenceID and the customer and contact table share the key ContactID.
I want to be able to use EF core to display data from all three tables and was wondering if there is a way to do it without using JOIN?
Below is my attempt but I get this error: SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
public class Customer
{
public string Name { get; set; }
[ForeignKey("Vehicle")]
public string ReferenceID { get; set; }
[ForeignKey("Contact")]
public string ContactID { get; set;}
public ICollection<Contact> Contact { get; set; }
public ICollection<Vehicle> Vehicle { get; set; }
}
public class Vehicle
{
public string ReferenceID { get; set;}
public string Make {get; set;}
}
public class Contact
{
public string ContactID {get; set;}
public string Name {get; set;}
}