locked
Customize Model-First to create singular table names RRS feed

  • Question

  •  

    I am using the Entity Framework model-first designer to develop my models.  When you run the "Generate Database from Model" command on the EDMX file, the resulting schema pluralizes the Table names (i.e. the Customer entity becomes a table named 'Customers').

    How can I customize the tool to output table names that are singular, or based on the entity name as opposed to being based on the entity set name?

    I downloaded the Entity Designer Database Generation Power Pack (DbGenToolkit) because I read you could use that to accomplish this, but I cannot find any documentation on how you would do so.

    Thanks in advance.


    --Ben
    Wednesday, March 23, 2011 4:04 PM

Answers

  • Hello Ben,

     

    Welcome to the EF Forum!

    As I know, the "Entity Designer Database Generation Power Pack" is a downloadable addition to Visual Studio 2010 Beta 2 which includes some new database generation technologies. The original Database Generation feature in the Entity Designer in VS 2010 is extensible via Windows Workflows and T4 Templates. This Power Pack builds on these extensibility mechanisms and introduces the following:

    1. Basic Table-per-Hierarchy support. This is represented by the “Generate T-SQL via T4 (TPH)” workflow.
    2. The SSDL and MSL generation pieces can now be tweaked through T4 templates, both in TPH and TPT strategies through the “Generate T-SQL via T4 (TPT)” and “Generate T-SQL via T4 (TPH)” workflows.
    3. Direct deployment and data/schema migration are available through the “Generate Migration T-SQL and Deploy” workflow. This workflow will use the Team System Data APIs to diff our default T-SQL script against the target database and create a new script which will perform non-invasive ALTERs and data migration where necessary.
    4. A new user interface will now display when “Generate Database from Model” is selected – this acts as a “workflow manager” which will present to you our default workflows and allow you to create your own, customizable workflows based on your own strategy, script generation, and deployment requirements.

     

    More information, please read this article:

    http://blogs.msdn.com/b/adonet/archive/2010/02/08/entity-designer-database-generation-power-pack.aspx

    I hope this can help you.

     

    Have a nice weekend,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jackie-Sun Monday, March 28, 2011 3:51 AM
    • Marked as answer by Jackie-Sun Wednesday, April 6, 2011 2:50 AM
    Saturday, March 26, 2011 7:12 AM

All replies

  • Hello Ben,

     

    Welcome to the EF Forum!

    As I know, the "Entity Designer Database Generation Power Pack" is a downloadable addition to Visual Studio 2010 Beta 2 which includes some new database generation technologies. The original Database Generation feature in the Entity Designer in VS 2010 is extensible via Windows Workflows and T4 Templates. This Power Pack builds on these extensibility mechanisms and introduces the following:

    1. Basic Table-per-Hierarchy support. This is represented by the “Generate T-SQL via T4 (TPH)” workflow.
    2. The SSDL and MSL generation pieces can now be tweaked through T4 templates, both in TPH and TPT strategies through the “Generate T-SQL via T4 (TPT)” and “Generate T-SQL via T4 (TPH)” workflows.
    3. Direct deployment and data/schema migration are available through the “Generate Migration T-SQL and Deploy” workflow. This workflow will use the Team System Data APIs to diff our default T-SQL script against the target database and create a new script which will perform non-invasive ALTERs and data migration where necessary.
    4. A new user interface will now display when “Generate Database from Model” is selected – this acts as a “workflow manager” which will present to you our default workflows and allow you to create your own, customizable workflows based on your own strategy, script generation, and deployment requirements.

     

    More information, please read this article:

    http://blogs.msdn.com/b/adonet/archive/2010/02/08/entity-designer-database-generation-power-pack.aspx

    I hope this can help you.

     

    Have a nice weekend,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jackie-Sun Monday, March 28, 2011 3:51 AM
    • Marked as answer by Jackie-Sun Wednesday, April 6, 2011 2:50 AM
    Saturday, March 26, 2011 7:12 AM
  • The original question is to ask how to create singular table names. Unfortunately the answer doesn't talk about that at all. While the uri in the answer doesn't talk about that neither.

    It is very frustrated to read such an answer from microsoft.

    Friday, June 8, 2012 11:44 PM