Subsonic 3 SimpleRepository NON Plural Table names?

穿精又带淫゛_ 提交于 2019-12-20 05:01:54

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!