I'm having trouble understanding how I can accomplish the following relationships:
public class Organisation {
public Guid Id { get; set; }
// Have a single user as an administrator of a company
public User AdminUser { get; set; }
// All users associated with the company (including the admin)
public ICollection<User> Users { get; set;}
}
public class User {
public Guid Id { get; set; }
// Each User must be associated with an Organisation.
[ForeignKey("Organisation")]
public Guid OrganisationId { get; set; }
public Organisation Organisation { get; set; }
}
Is that something that can be done via Inverse Properties? I understand that they are a solution to define multiple relationships between the same entities, but I'm struggling to see how I can set this up for my situation. Could someone help out with example code?
Thanks in advance.
Organization
fromUser
in OOP?