如何用流畅的Api将外键从两个不同的表映射到一个表?我的两个模型就像
public class Customer
{
[Key]
public string Userid { get; set; }
public string PassWord { get; set; }
public bool premium { get; set; }
}
public class Roles
{
[Key]
public string Name { get; set; }
public string Description { get; set; }
}
并且具有上表的主键作为外键的第3表?
public class CustomerRoles
{
public string RoleName { get; set; }
public string UserId { get; set; }
}
如何映射Fluent Api?
1 回答
PS:类名不应该是复数,它可能与数组属性混淆 .
更新如何使用它