While using SubSonic 3 I wrote the below. I thought I would get user_ref would be a column with name_list as its foreign key. My database ended up with just id and link with only the image_list table.
How can I have user_ref use name_list as its foreign key and have both tables in the database?
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);
}
The SimpleRepository can't build foreign keys at all: it puts no logic in the DB, just data. If you want foreign keys, you need to build the db first, and use ActiveRecord or the LINQ templates...