I am trying to separate the models in MVC 5 into a separate project called entities and have a different data access project.
- Project.Entities - domain models Project.Data - Data access layer with entity framework and repositories Project.Web - MVC Project
I have a class as shown below and would like to have it use the ApplicationUser Id as a foreign key
public class PoolMember
{
public int PoolMemberId { get; set; }
public int PoolId { get; set; }
public int UserId { get; set; }
public AjoMemberStatus MemberStatus { get; set; }
public DateTime DateJoined { get; set; }
public Nullable<DateTime> DateStatusChanged { get; set; }
public int PoolPayoutPosition { get; set; }
public Pool Pool { get; set; }
[ForeignKey("UserId")]
public ApplicationUser ApplicationUser { get; set; }
}
It looks like my options are to move my entities into the same namespace as the ApplicationUser (which means adding it to the mvc project) or try to move the applicationuser out of the MVC project into the entities project.
My question is if anyone has any suggestions on a sustainable approach that allows the applicationuser class to be used as a foreign key in the models.