EF Core Code First - 没有 ID 的一对多关系

问题描述

给定两个看起来像这样的模型

public class ParentEntity {
    public int Id {get; set;}
    public string Name {get; set;}
}

public class ChildEntity {
    [Key]
    public string ISOCode {get; set;}
    public string Name {get; set;}
}

关系应该是ParentEntity * ----- 1 ChildEntity。我不确定如何在 ParentEntity 模型中“配置”这种关系,因为在这种情况下 ChildEntity Key 不是整数。

任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)