tags:

views:

58

answers:

1

When I generate LINQ-to-SQL classes for a table named ApplicationMenus it doesn't create a singular class for it so that the statement:

ApplicationMenu applicationMenu = new ApplicationMenu();

gives an error.

If I change the name of the table to one of these:

Menus
ApplicationMenuItems

then it correctly generates the singular class.

Why does LINQ-to-SQL have a problem with "ApplicationMenus" and what other names will cause a problem as well?

alt text

A: 

You could use reflector to find out, or you could ask yourself why you have pluralized table names ;-)

klausbyskov
Perhaps because he has a "table of application menus"? instead of "table of application menu"? It's like "public List<Employee> Employee { get; set; }" in C#, it just gives you the wrong impression. Is it 1 employee or a list of employees, or what? Of course, if the "application menu" is a list of items, so that the table actually contains items instead of multiple menus, then the naming is just odd.
Lasse V. Karlsen