我刚刚开始使用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>();}
}
Run Code Online (Sandbox Code Playgroud)
现在当我生成数据库时,我的文件表有一个PersonID AND EventID.
我希望能够让用户将文件附加到人和/或事件.