我有一个非常混乱的遗留数据库设计,由于数据的当前状态,我无法更改。我想以某种方式“模拟”与数据库中未定义的实体框架的关系,特别是为了能够利用在应用程序的其他区域中运行良好的延迟加载。
结构类似于:
class Father {
[Key]
public int Id {get;set;}
public string someIdentifier {get;set;}
}
class Kid {
[Key]
public int Id {get;set;}
public string SomeIdentifier {get;set;}
public string Name {get;set;}
}
一个父亲可以有多行 'Kid',并且必须使用 someIdentifier 字符串来建立关系。此外,孩子们也可以有多排父亲。这种关系没有在数据库中表达,这就是我谈论“仿真”的原因。我不知道是否有可能有一些父亲/孩子类,如:
class Father {
[Key]
public int Id {get;set;}
public string someIdentifier {get;set;}
public virtual<Kid> Kids {get;set;}
}
class Kid {
[Key]
public int Id {get;set;}
public string SomeIdentifier {get;set;}
public string Name {get;set;}
public virtual<Father> Fathers {get;set;}
}
非常感谢!