我刚刚开始使用 EF,并且观看了一些很棒的教程视频。我坚持以下。
我有一个文件集合类,我希望这些文件与事件和/或人相关联
public class file{
public int id {get;set;}
public string path {get;set;}
}
public event {
public int id {get;set;}
public string eventname {get;set}
public virtual ICollection<file> files {get;set;}
public event(){ files = new list<file>();}
}
public person {
public int id {get;set;}
public string name {get;set}
public virtual ICollection<file> files {get;set;}
public person(){ files = new list<file>();}
}
现在,当我生成数据库时,我的文件表有一个 PersonID 和 EventID。
我希望能够让用户将文件附加到人员和/或事件。