Generating C# 2.0 Files

You generate C# 2.0 source files from the classes and interfaces of a model. A separate file, with the file extension .cs, is generated for each class or interface that you select from the model, along with a generation log file.

The following PowerDesigner variables are used in the generation of C# 2.0 source files:

Variable

Description

CSC

C# compiler full path. For example, C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\csc.exe

WSDL

Web Service proxy generator full path. For example, C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\wsdl.exe

To review or edit these variables, select Tools > General Options and click the Variables category.

  1. Select Language > Generate C# 2 Code to open the C# 2.0 Generation dialog.
  2. Enter a directory in which to generate the files, and specify whether you want to perform a model check (see Checking an OOM).
  3. [optional] Select any additional targets to generate for. These targets are defined by any extensions that may be attached to your model (see Working with Generation Targets).
  4. [optional] Click the Selection tab and specify the objects that you want to generate from. By default, all objects are generated.
  5. [optional] Click the Options tab and set any appropriate generation options:

    Option

    Description

    Generate object ids as documentation tags

    Specifies whether to generate object ids for use as documentation tags.

    Sort class members primarily by

    Specifies the primary method by which class members are sorted:
    • Visibility

    • Type

    Class members type sort

    Specifies the order by which class members are sorted in terms of their type:
    • Methods – Properties - Fields

    • Properties – Methods - Fields

    • Fields – Properties - Methods

    Class members visibility sort

    Specifies the order by which class members are sorted in terms of their visibility:
    • Public - Private

    • Private – Public

    • None

    Generate Visual Studio 2005 project files

    Specifies whether to generate project files for use with Visual Studio 2005.

    Generate Assembly Info File

    Specifies whether to generate information files for assemblies.

    Generate Visual Studio Solution File

    Specifies whether to generate a solution file for use with Visual Studio 2005.

    Generate Web Service code in .asmx file

    Specifies whether to generate web services in a .asmx file.

    Generate default accessors for navigable associations

    Specifies whether to generate default accessors for navigable associations.

    Note: For information about modifying the options that appear on this and the Tasks tab and adding your own options and tasks, see Customizing and Extending PowerDesigner > Object, Process, and XML Language Definition Files > Generation Category.
  6. [optional] Click the Generated Files tab and specify which files will be generated. By default, all files are generated.

    For information about customizing the files that will be generated, see Customizing and Extending PowerDesigner > Extension Files > Generated Files (Profile).

  7. [optional] Click the Tasks tab and specify any appropriate generation tasks to perform:

    Task

    Description

    WSDLDotNet: Generate Web service proxy code

    Generates the proxy class

    Compile source files

    Compiles the source files

    Open the solution in Visual Studio

    Depends on the Generate Visual Studio 2005 project files option. Opens the generated project in Visual Studio 2005.

  8. Click OK to begin generation.

    When generation is complete, the Generated Files dialog opens, listing the files that have been generated to the specified directory. Select a file in the list and click Edit to open it in your associated editor, or click Close to exit the dialog.