Area类
public virtual User User { get; set; }
User类
public virtual Area Area { get; set; }
Context类
modelBuilder.Entity<Area>() //巡检区域-区域负责人
.HasOptional(a => a.User)
.WithOptionalDependent()
.Map(x => x.MapKey("UserID"));
modelBuilder.Entity<User>() //巡检区域-区域负责人
.HasOptional(u => u.Area)
.WithOptionalDependent()
.Map(x => x.MapKey("AreaID"));