0
我使用EF代码第一次和我的数据库模型有效看起来如下:EF错误:多重不在角色
public abstract class Job
{
public int Id { get; set; }
public JobResult Result { get; set; }
}
[Table("RegisterDomainJobs")]
public class RegisterDomainJob : Job
{
}
public abstract class JobResult
{
public int Id { get; set; }
[ForeignKey("Job")]
public int JobId { get; set; }
[Required]
public virtual Job Job { get; set; }
}
[Table("GenericJobResults")]
public class GenericJobResult : JobResult
{
}
然而,当我运行更新,数据库命令我得到以下错误:
JobResult_Job_Source: : Multiplicity is not valid in Role 'JobResult_Job_Source' in relationship 'JobResult_Job'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'.
奇怪的是,这个错误只发生在我不断:
[ForeignKey("Job")]
public int JobId { get; set; }
在我的模型中。
这个问题的原因是什么?
啊我看 - 这非常合理。 非常感谢! – JensOlsen112 2014-11-01 19:17:50