This sample program demonstrates how easy it is to navigate, query and report on the current model using any Microsoft .NET language. This example is written in C#.
When run, it will print the names of every Package in the model you are currently using.
Create the Project
In the Browser window, select the Package in which to create the template, then use the 'Develop > Source Code > Create from Pattern' ribbon option to display the Patterns window; click on the 'Application Patterns' option.
From the 'Application Patterns' page, select the Microsoft C# > RepositoryInterface template. (You can choose from either the 3.5 or the 4.0 framework versions.) Specify the destination folder on the file system where the project template will be created, and click on the.
Open the Project
A Package structure similar to this will be created for you.
Expand the structure until you locate the Repository Interface n.n diagram and open it.
Build the Script
The commands on this diagram will operate on the active build configuration. Before executing them, double-click on the Analyzer Scripts link and select the checkbox next to the 'Repository Interface' build configuration.
Run the Script
Double-click on the Run link to open the Console. The Console will pause after completion so you can read the output from the program; this output will also be sent to the 'Script' tab of the System Output window. You can alter this by changing the code.
Debug the Script
Select the 'Program' Class from the Browser window and press to open the source code.
Place a Breakpoint in one of the functions and then double-click on the DebugRun link. When the Breakpoint is encountered, the line of code will become highlighted in the editor, as shown: