table/column names RRS feed

  • Question

  • User-1712241964 posted

    examples of some table names in my DB:
    Teams, Seasons, Scores, etc....
    examples of some column names in these tables:
    Team, Season, Score, etc.... (respectivly)

    Without any customization, when I create a new DynamicData site, the "s" is getting dropped from the table name and a 1 is being appended to my column names.

    Am I doing something wrong?  or is this expected behavior?

    Thank you

    Thursday, July 17, 2008 11:15 AM


All replies

  • User-797310475 posted

     Hi Gary,

    this is done at the level of the LINQ to SQL or Entity Framework model that you generate (and each of these technologies behaves slightly differently in that regrard). Fortunately, you can use the designer to modify the names of the generated entities and collections. Alternatively, you can apply DisplayNameAttribute to items of interest.

    Thursday, July 17, 2008 12:08 PM
  • User-1712241964 posted

    I do understand that this is done in the db model, and can be modified.   I'm trying to understand though if there is a reason why LINQ to SQL is doing this, or if it is something that should be fixed by Microsoft.
    EF doesn't exhibit this behavior for me, though I won't be using EF because it seems to require full trust. (most of my solutions are developed for shared hosting environments with medium trust)
    As it happens, all of the tables in the DB I am testing with have a trailing "s" (Teams becomes Team, Seasons becomes Season), but....
    If I had a table named "Microsoft", would it, by default without correction, be presented to the user as "Microsof"?  Is it just something about trailing "s"s?    Is it something about my database being handled differently?
    Similar argument regarding the column names.     If I could understand why it is doing this, then I would know whether I need to modify my db, wait for the official release of SP1, or put an 'enhancement request' in to Microsoft.

    Thank you,

    Thursday, July 17, 2008 1:21 PM
  • User-330204900 posted

    The technique Linq to SQL is called pluraisation have a look at How to: Turn Pluralization On and Off (O/R Designer) this my answer you question and resolve it [:D]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 17, 2008 1:26 PM
  • User-1712241964 posted

    That was it!
    That solved both issues!
    So... obviously, in a situation where the table name is Teams, and one of the columns in that table is Team, the only reason the "1" was placed at the end of the column name was because it would have had the same name as the table, after the table name had had it's "s" removed!
    Thanks again for helping a novice!


    Thursday, July 17, 2008 1:42 PM