How to: Add a Post.sql File to the SetupApplication Project
[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 third of six tasks that apply SQL Server Modeling Services patterns to a Microsoft code name “M” model. In the previous parts of this tutorial, you modify a SetupApplication model to support Modeling Services patterns. You also describe the Modeling Services patterns that should be applied by using the PatternApplication module. The required patterns are described by instances of the ModulePatternApplications
and EntityPatternApplications
extents.
This topic describes how to apply the Modeling Services patterns by calling the [Repository.Item].[ApplyStandardPatternsToModels]
stored procedure. This stored procedure is installed by the PatternApplication sample. For more information, see Using the PatternApplication Sample.
To add a Post.sql script that calls the [Repository.Item].[ApplyStandardPatternsToModels] stored procedure
In Visual Studio 2010, open the previously created SetupApplication project.
In Solution Explorer, right-click the SetupApplication project, select Add, and then click New Item.
Select the Text File template.
Name the new file Post.sql, and then click Add.
Add the following statements to the Post.sql file.
execute [Repository.Item].[ApplyStandardPatternsToModels]; go
To change the build action for the Post.sql file to MPostSql
You must manually modify the Visual Studio 2010 project file to set the build action for Post.sql files. Begin by unloading the project in Solution Explorer. Right-click the SetupApplication project, and then click Unload Project.
Right-click the SetupApplication project again, and then click Edit SetupApplication.csproj. The project should open in a new text editor window.
Locate the
ItemGroup
element that contains a reference to Post.sql file.Change the child element from
Content
toMPostSql
. The following XML shows the changed contents of theItemGroup
node for the Post.sql file.<ItemGroup> <MPostSql Include="Post.sql" /> </ItemGroup>
Warning
You can ignore any warnings that
MPostSql
is an invalid child element.Save and close the SetupApplication.csproj file in the text editor.
In Solution Explorer, right-click the SetupApplication project, and then click Reload Project.
Warning
Do not yet deploy this model to the SetupApplicationDB database. There are complications for repeated deployments that are discussed later in this tutorial.
The next step discusses how to deploy the modified SetupApplication model to a Modeling Services database. For more information, see How to: Deploy a Domain that Uses SQL Server Modeling Services Patterns.
See Also
Concepts
Adding Modeling Services Patterns to the SetupApplication Model
Other Resources
Getting Started with the SQL Server Modeling CTP (SetupApplication Tutorial)