【发布时间】:2009-12-23 14:06:21
【问题描述】:
在使用 SubSonic 3 时,我编写了以下内容。我想我会得到 user_ref 将是一个以 name_list 作为外键的列。我的数据库最终只有 id 并且只与 image_list 表链接。
如何让 user_ref 使用 name_list 作为其外键,并在数据库中拥有两个表?
class image_list
{
public long ID { get; set; }
public name_list user_ref{ get; set; }
public string link{ get; set; }
}
class name_list
{
public long ID;
public string username;
}
{
var a = new image_list();
a.link = "link";
a.user_ref = new name_list();
a.user_ref.username = "name";
repo.Add(a);
}
【问题讨论】: