0

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);
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

1

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...

Community
  • 1
  • 1
Jaykul
  • 15,370
  • 8
  • 61
  • 70
  • So is there no way to build a database? I have to do it by hand or write my own sql code? –  Dec 26 '09 at 18:02