I'm using SubSonic 3.0.0.3, and I can't seem to get ActiveRecord ActiveX files to recognize and generate code for foreign keys and relationships in my SQLite database.
I think that it generates everything else just fine, but, looking at other snippets online, it looks like there should be more code generated than just one class in ActiveRecord.csand Structs.csfor each of my tables. Inside Structs.cs, IsForeignKeyalways falsefor every column, even for those for which I set a foreign key. In addition, each area is Foreign Keysempty in each generated ActiveRecord class.
I am using VS2008 with links to SubSonic 3.0.0.3, System.Data.SQLite 1.0.66.0 and System.Data.SQLite.Linq 2.0.38.0 in my project. I created a database using SQLite Expert Personal 3.1.0.2076. I made some dummy tables to try and check how SubSonic handles one: many, many: many relationships. This is where DDL SQLite Expert spills out my small database:
CREATE TABLE [Person] (
[PersonID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[PersonName] TEXT NOT NULL,
[PersonAge] INT NOT NULL
);
CREATE TABLE [Group] (
[GroupID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[GroupName] TEXT NOT NULL,
[GroupDescription] TEXT NOT NULL
);
CREATE TABLE [Dog] (
[DogID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[PersonID] INT NOT NULL CONSTRAINT [DogPersonFK] REFERENCES [Person]([PersonID]) ON DELETE CASCADE ON UPDATE CASCADE,
[DogName] TEXT NOT NULL);
CREATE TABLE [GroupPersons] (
[GroupID] INTEGER NOT NULL CONSTRAINT [GroupPersonToGroupFK] REFERENCES [Group]([GroupID]) ON DELETE CASCADE ON UPDATE CASCADE,
[PersonID] INTEGER NOT NULL CONSTRAINT [GroupPersonToPersonFK] REFERENCES [Person]([PersonID]) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT [sqlite_autoindex_GroupPersons_1] PRIMARY KEY ([GroupID], [PersonID]));
, . SQLite Expert , , , Person PersonID, PersonID Dog GroupPersons. , " ", .tt, . , , Person, Dog Group x.Save(), System.Data.SQLite , SQLite error near "WHERE":syntax error. Save().
, ?