OxyGen Code Generator Overview. 4   Table of Contents. 4
Previous Topic: Generating Stored Procedure Configurations. 4   Next Topic: Validating Database Configuration. 4

 

Generating Source Code

A step by step description on how to generate code using OxyGen Code Generator follows

  1. Open OxyGen Code Management Studio.
  2. In the Connect to Server dialog specify the Server Name, the Authentication mode, user credentials (if SQL Server Authentication is selected), and then click the Connect button.

The Database Explorer tree control is populated with the databases for the specified server. Accessible databases are depicted by an enabled cylinder () while the databases that are not accessible are depicted by a disabled cylinder ().

 

NoteNote

In Windows Vista, some of the databases may be not accessible if Windows Authentication is selected and the application does not run under an administrator role.

  1. Click Processing\Source Code Generator Wizard… menu item (or the Source Code Generator toolbar item). The Code Generator Settings wizard is displayed in “Figure 34: Code Generator Settings wizard. Database connectivity step”.

Figure 34: Code Generator Settings wizard. Database connectivity step

  1. In the Database Connectivity step, specify the Server Name, Authentication, Database Name, Connection Timeout (measured in seconds), User Name (SQL account user name to connect to the database), and Password.
  2. To test your connection settings, click the Check Connection button. If the check fails review your Server Name information. The Server name of a SQL Server database instance is not always the machine name.
  3. Click the Next button. The Database Objects step is displayed.
  4. In the Database Objects step specify the tables, views and stored procedures primarily used to generate the source code.
  5. Click the Next button. The Component Packages step is displayed.
  6. Specify the desired component package to be generated by selecting the appropriate radio button from the Component Packages radio buttons group. OxyGen Code Generator generates 4 kinds of application model components.
    1. Stored Procedures
    2. Data Access Layer
    3. Business Layer
    4. Hosted applications:

Appendix B – Source Code Component Packages” describes the source code component packages.

  1. Click the Next button. The Solution and Project Settings step is displayed.
  2. Specify the Visual Studio solution and project formats, the solution name and the project names for the generated source code.  For Visual Studio 2008 file format we can specify the target framework (2.0, 3.0 or 3.5)
  3. Click the Next button. The Data Activities step is displayed.
  4. Specify the desired stored procedures categories to be generated. The Retrieve Stored Procedures is preselected and compulsory.
  5. Click the Next button. The Paging and Caching Settings step is displayed.
  6. Specify the generated code paging and caching options.
  7. Click the Next button. The Stored Procedures Configuration step is displayed.
  8. Specify the SQL logins from which the Stored Procedures’ execute right is granted.
  9. Click the Next button. If any of the C# output components (Data Access Layer or Business Layer) are selected in the Components section, the Generated Code Settings step is displayed; otherwise the Source Code Publishing Settings step is displayed. In the Generated Code Settings step, you specify the namespaces for your C# components (Data Access and Business Layers)
  10. Click the Next button. The Data Access Layer Settings step is displayed.
  11. Specify the data access layer settings for the generated source code and create additional Interfaces, Class Attributes, Method Attributes and Member Attributes.  Click the Next button and the Business Layer Settings step is displayed.
  12. Specify the business layer root namespace, the assembly name, the intercepts settings and optionally the base class name, interfaces and attributes for generated source code. Click the Next button and the Service Layer Settings step is displayed.
  13. Specify the services root namespace, intercepts options and the service interface class name for the generated source code. Click the Next button and the Web Service Settings step is displayed.
  14. Specify the Web Services attributes and the intercepts option for the generated source code. Click the Next button and the WCF Services Settings step is displayed.
  15. Specify the WCF Services attributes, the intercepts options and binding and behavior options for the generated source code. Click the Next button and the Source Code Publishing Settings step is displayed.
  16. Select the publishing settings for the generated source code.  Specify the publishing root folder or specify the folder for every single component separately.
  17. Click the Next button. The Code Generation Actions step is displayed.
  18. In the Code Generation Actions step, we can optionally, specify the following:
    1. The Pre-generation and Post-generation command lines. These are cmd.exe statements that can be executed prior to or after code generation.
    2. Run Stored Procedures SQL scripts. After code generation, this option will cause scripts to run that will create the Stored Procedures in the database.
    3. Compile Data Entities. After code generation, this option will cause the compilation of the DAL using csc.exe
    4. Compile Business Entities. After code generation, this option will cause the compilation of the BL using csc.exe
    5. Open generated code with Code Explorer.
    6. Open generated code with Visual Studio.
    7. Start Web UI. After code generation, this option starts up the Web Server that comes with the .NET Framework (WebDev.WebServer.EXE) and then browses to the default page of the generated ASP.NET UI.
  19. Click the Next button. The Code Generator Review step is displayed.

Figure 35: Code generation review step screen

  1. Click the Finish button to invoke the code generator or the Cancel button to cancel the process and close the dialog.
    The processing instructions can optionally be validated before starting code generation. It is recommended that the processing instruction be validated if the code is generated for the first time against any particular database. When code generation is started, a progress dialog is displayed informing the user about the code generation step that is currently being performed. You can abort the code generation process by clicking the Cancel button. The following screen shot shows the Code Generator Progress dialog box.

Figure 36: Code Generator Progress dialog

  1. On a successful code generation session, the source code explorer dialog is displayed. This allows the user to view the files (T-SQL, C# and ASP.NET) that have been generated.

OxyGen Code Generator Overview. 4   Table of Contents. 4
Previous Topic: Generating Stored Procedure Configurations. 4   Next Topic: Validating Database Configuration. 4