I have two Entities i.e. Employee and Company. Both of these can have one or many addresses. As Guid is always unique, so i want to use Guid in Employee and Company as a foreign key in Address.
That's there can be multiple entries in Address for Employee and Guid of Employee will be in Guid Field of Address.
In the same way, There can be multiple addresses for a company as well. And Guid of Company will be in Guid of Address.
Can you please help me how to configure relationship b/w Employee-Address and Company-Address using Fluent APIs
public class Employee
{
public int EmployeeId;
public Guid Guid;
.
.
.
public ICollection<Address> Addresses;
}
public class Company
{
public int CompanyId;
public Guid Guid;
.
.
.
public ICollection<Address> Addresses;
}
public class Address
{
public int AddressId
public Guid Guid; // Guid from Employee or Company
.
.
. // Should here be Navigation to Employee/Company as well?
}