views:

26

answers:

1

While using SubSonic 3 i wrote the below. I thought i would get user_ref would be a column with name_list as its foriegn 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 foriegn 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);
}
+1  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...

Jaykul
So is there no way to build a database? I have to do it by hand or write my own sql code?
acidzombie24