Reputation: 18792
I am using SubSonic on a project with many tables which were created by a sourcecode generator. I noticed Some classes created by SubSonic were generated without code and have the folowing message
The class...was not generated because ... does not have a primary key.
Is there any way for me to get the code to be generated without adding keyes to all the tables?
Thanks
Upvotes: 0
Views: 228
Reputation: 1294
SubSonic requires primary keys on tables to generate its code.
From the documentation: http://subsonicproject.com/docs/Conventions
Primary Keys
If you want to use SubSonic to access your table, you need to have a Primary Key defined for your table. This is good practice in every case and we need it to do certain things with your table. If you don't have a Primary Key defined, your class won't be generated.
If you don't believe us, or if you think this is a silly convention - SubSonic isn't for you.
Upvotes: 0
Reputation: 4219
Add primary key to table. You can create an auto-increment int field as primary key.
This happens with almost every database layer code generator, because without primary key it cannot generate edit/delete functionality.
Upvotes: 1