Tutorial :Restrictions on Table Names



Question:

Are there any restrictions on the names of tables, or issues with certain names when working with SubSonic? I have table called 'Activity' and SubSonic doesn't seem to recognise it. When it was called 'Activities' it worked fine.

Basically I am wanting to go with singular table names as a convention (and the other conventions as detailed in the SubSonic Conventions blog post) and added fixPluralClassNames="false" to the web.config (because I have a table called 'Focus', which SubSonic kept naming 'Focu')


Solution:1

Generally, reserved words in C# are not allowed as table names. I'm not sure why Activity would be a problem though. The first thing to check when a table is not generated is that the table has a primary key.


Solution:2

One common problem that I ran into was it would not work if my tables begin with special characters or numbers. Changing that fixed it on my end. Apart from that I did not run into any other issues.


Solution:3

Clearing files in the Temporary ASP.NET Files folder (After closing Visual Studio), or changing the .abp file seems to be a valid fix to this.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »