是否可以基于ef core中的备用键创建反向属性?
public class Profile
{
public int ProfileId { get; set; }
public int? SubProfileId { get; set; }
public SubProfile SubProfile {get;set;
[InverseProperty(nameof(OtherEntity.Profile)]
public ICollection<OtherEntity> OtherEntities { get; set; }
// Is there away to achieve this without ef core doing what ef core does "best"
// and do funky things, as it does in this case and add "hidden" properties to the sql table?
[InverseProperty(nameof(OtherSubEntity.SubProfile)]
public ICollection<OtherSubEntity> OtherSubEntities { get; set; }
}
如果我有一个上面定义的实体,那么就可以实现第二个反向属性,而无需ef core向它在sql中创建的其他子实体添加自定义属性。
暂无答案!
目前还没有任何答案,快来回答吧!