Chapter 15 Working with the PowerDesigner Plugin for Visual Studio
Code Synchronization
The PowerDesigner plug-in for Visual Studio enhances the standard PowerDesigner code generation and reverse-engineering to permit real-time synchronization of model and code.
You configure synchronization initially through the Synchronization Wizard, and then can continue with development, with additional changes automatically cascaded to the code.
Note that code synchronization is available for all PowerDesigner diagrams and models supporting generic generation, and thus could be used with, for example, a state diagram, or a BPM (Business Process Model).
To synchronize your model and code:
- Create an empty Visual C# or other code project, and then add your model project to the solution.
- Select the model in the Solution Explorer, and then click the Synchronize tool in the toolbar (or Synchronize from the contextual menu) to open the Synchronize dialog at the Code Generation page:
- This page allows you to specify file types that will be synchronized for forward generation (i.e. changes made to model objects will be cascaded down immediately to the code files). File types are organized by generation targets (C# 2.0 and WSDL for .NET in the screenshot above), and defined in the resource file or extended model definition for the target.
Select the file types that you want to synchronize for forward generation.
- [optional] Select a file type and click the Details button to open the Generation Details dialog (see Custom Generation Post-Processing with Genlets for more information):
- Click Next to move to the Reverse-engineering page of the Synchronization dialog:
This page, which is available only for C# and Visual Basic projects only) allows you to specify file types that will be synchronized for reverse-engineering (i.e. changes made in the code files will be cascaded up immediately to the model objects).
Select the file types that you want to synchronize for reverse-engineering.
- Click Next to move to the Files page of the Synchronization dialog:
This page allows you to specify the specific files that will be synchronized, and where they will be generated.
By default:
- If the model is located directly in a solution folder (outside of a project) or in a modeling project, the files are generated at the root of the solution, and project files are added as projects in the Solution Explorer.
- If the model belongs to any other project type, the files are generated by default at the root of the project, or in another folder within the project specified in the Root Folder field.
If there is the possibility of a conflict because both model object and file already exist, the file will not be selected to generate by default, and its checkbox will carry a small red cross. To force synchronization and specify who will have priority, click the checkbox and select Overwrite file or Overwrite model from the contextual menu. You can also click Select All select all the files for overwriting.
- Select the files that you want to synchronize and click Finish.
The wizard generates and marks as synchronized all the specified files.
Copyright (C) 2008. Sybase Inc. All rights reserved.
|
|