Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Customize Database Generation

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic describes how to customize the data description language (DDL) that is generated by the Generate Database Wizard. For information about the default DDL that is generated, see Database Generation Rules.

The Create Database Wizard uses Windows Workflow Foundation and text templates to perform the following steps:

  1. Generate store schema definition language (SSDL) that is based on your conceptual model.

  2. Generate mapping specification language (MSL) that maps the SSDL to your conceptual model.

  3. Generate DDL based on the SSDL.

The default workflow and default text template that are used by the Create Database Wizard are specified in the Database Generation Workflow and DDL Generation Template properties of a conceptual model. The following procedures describe how to configure your project so that the Create Database Wizard uses a custom workflow or a custom text template (or both) in the DDL generation process. The procedures assume that you have an .edmx file open in the Entity Data Model Designer (Entity Designer) and that you have designed a conceptual model.

Dd560887.note(en-us,VS.110).gifNote:
Customizing either the workflow or the text template usually requires customizing both.

To customize the database generation workflow

  1. Add a custom Windows Workflow (a .xaml file) to your project or put your custom .xaml file in the following location: %localappdata%\Microsoft\[AppId]\10.0\Extensions\Microsoft\Entity Framework Tools\DBGen where [AppId] depends on your Visual Studio edition.

  2. Right-click the Entity Designer surface and select Properties.

  3. Set the value of the Create Database Workflow property to the path of your custom .xaml file relative to your project directory. You can also use the full path of your custom .xaml file. Files put in the path shown in step one will be available as property values (the value will be the file name appended with (User)).

    The Create Database Wizard will now use the specified workflow when generating DDL from your model. The workflow will use the text template specified in the DDL Generation Template property to generate DDL from SSDL.

Dd560887.note(en-us,VS.110).gifNote:
Do not modify the default .xaml file used by the Create Database Wizard. You can, however, modify a copy of the default .xaml file and then follow the previous instructions.

To generate DDL, launch the Create Database Wizard. For information see, see How to: Generate a Database from a Conceptual Model.

To customize the SSDL-to-DDL generation

  1. Add a custom text template (a .tt file) to your project or put your custom text template in the following location: %localappdata%\Microsoft\[AppId]\10.0\Extensions\Microsoft\Entity Framework Tools\DBGen where [AppId] depends on your Visual Studio edition.

    Dd560887.note(en-us,VS.110).gifNote:
    When you add a .tt file to your project, a Security Warning will appear. For more information, see Security of Text Templates.

  1. Right-click the Entity Designer surface and select Properties.

  2. Set the value of the DDL Generation Template property to the path of your custom .tt file relative to your project directory. You can also use the full path of your custom .tt file. Files that you put in the path that is shown in step one will be available as property values. The value will be the file name appended with (User).

    The Create Database Wizard will now use the specified text template when generating DDL from SSDL.

Dd560887.note(en-us,VS.110).gifNote:
Do not modify the default .tt file used by the Create Database Wizard. You can, however, modify a copy of the default .tt file and then follow the instructions above.

To generate DDL, launch the Create Database Wizard. For information see, see How to: Generate a Database from a Conceptual Model.

See Also

Show:
© 2014 Microsoft. All rights reserved.