How to: Deploy a Domain that Uses SQL Server Modeling Services Patterns

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

This is the fourth of six tasks that apply SQL Server Modeling Services patterns to a Microsoft code name “M” model. In this tutorial, you modify a basic SetupApplication model in Microsoft code name “M” to apply more advanced Modeling Services patterns. In this topic, you deploy the modified SetupApplication model to the SetupApplicationDB database.

There are a few complications with the deployment of a domain that uses Modeling Services patterns. There are two limitations that keep the domain from being uninstalled from the database. First, the PatternApplication module contains references to the “M” catalog tables. This causes a violation of a foreign key constraint when the tools attempt to remove the rows in the catalog tables that are associated with the SetupApplication model. The second problem is that images with embedded Post.sql files cannot be uninstalled, because the uninstaller can't determine how to reverse the custom operations in the Post.sql file. At this time, you must drop and recreate the target database to iterate models that use Modeling Services patterns.

To deploy the modified SetupApplication model

  1. In Visual Studio 2010, open the previously created SetupApplication project.

  2. On the Build menu, click Rebuild Solution.

    Advertencia

    It is important to select Rebuild Solution rather than Build Solution. This ensures that the latest version of the model is deployed and that the recently added Post.sql file is included in the build.

  3. In Solution Explorer, right-click the SetupApplication project, and then click Deploy.

  4. In the Output window, verify that the deployment succeeded.

To redeploy the SetupApplication model

  1. Open the SetupApplication.m file.

  2. Add a constraint to the Name field of the ProductsTable extent that limits the length to 200 characters.

    Name : Text where value.Count < 200;
    
  3. In Solution Explorer, right-click the SetupApplication project, and then click Deploy. Note that the deployment fails. For more information about the failures, see the discussion at the beginning of this topic.

  4. On the Start Menu, click All Programs, Microsoft SQL Server Modeling CTP, and open the Microsoft SQL Server Modeling CTP Command Prompt.

  5. First, recreate the SetupApplicationDB database by using the Mx.exe tool. The force option drops the target database and the create command creates the database and installs the “M” catalog.

    mx.exe create /d:SetupApplicationDB /force
    
  6. Install the Base Domain Library (BDL). The following command provides an example, but it may need to be adjusted depending on the installation directory of the SQL Server Modeling CTP.

    mx.exe install Repository.mx /database:SetupApplicationDB /server:(local) /property:rct=+ /property:ra=+
    
  7. Navigate to the directory that contains the PatternApplication.mx image file for the PatternApplication sample.

  8. Use Mx.exe to install the PatternApplication sample into the SetupApplicationDB database.

    mx.exe install PatternApplication.mx /database:SetupApplicationDB
    

    Sugerencia

    For more information about installing the BDL and the PatternApplication sample, see How to: Describe Required Patterns with the PatternApplication Sample.

  9. In Visual Studio 2010, rebuild and deploy the SetupApplication model.

    Sugerencia

    Consider creating a batch file (.BAT) that contains the previous three commands. This makes it easier to recreate the database each time you have to deploy a new version of the model. You can call the batch file once instead of typing three separate commands.

See Also

Concepts

Adding Modeling Services Patterns to the SetupApplication Model

Other Resources

Getting Started with the SQL Server Modeling CTP (SetupApplication Tutorial)