问题
Is it possible to use SubSonic 3's Simple Repository with non-plural table names? My DB already exists, the table names a re singular add I cannot change them.
回答1:
Nope, it is hardcoded in the SubSonic's source. You can pull it down and trace the migration steps to see where the plural happens. I know, cause I wanted the same thing.
I was tinkering with modifying the source to make plurals optional via some parameter/config override or alike. But, I didn't get it completed (yet).
回答2:
If your tables already exist then this is not the intended use of the Simple Repository model. The simple repository model is designed to generate the table structures for you using migrations.
If you are using a database that already exists then you would be better served using the T4 Templates as they also support the relationships between your tables.
Cheers,
Ed
回答3:
With Subsonic 3.0.0.4 in the settings.ttinclude
I removed the line;
AddSingularRule("s$", String.Empty);
which was down about 260 lines in the Inflector
rules class. Didn't need to mess around with the subsonic source code.
HTH
来源:https://stackoverflow.com/questions/1780906/subsonic-3-simplerepository-non-plural-table-names