Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to add a generator to the model project
xomega
#1 Posted : Thursday, November 8, 2012 6:46:28 PM(UTC)
xomega



If you develop a new generator or have an existing generator that is not part of your Xomega model project, you can easily add it to your project file, which will allow you to configure and run the generator from Visual Studio or run it from a command line either manually or automatically as part of the build process. Running it from a command line could be useful on a build server during continuous integration.

The following steps explain the details on how to add the generator to your model project file.
  1. Add an XomGenerator element under the ItemGroup element that contains other generators. If you need the generators to be run in a certain sequence, then you can arrange the XomGenerator nodes accordingly.
  2. Set the Include attribute to the full path of the generator's XSL. You can use the $(XomegaHome) parameter to specify the Xomega installation folder including the trailing slash.
  3. Add a child Name element and set the generator's name as its value.
  4. Add a child Folder element and set its value to be the slash delimited folder path that will be used to group and organize generators in the model project.
  5. Add a child OutputPath element and set its value to the output path for the generator using appropriate placeholders as supported by the generator.
  6. Add a child IncludeInBuild element and set its value to true, if you want the generator to be automatically run when you build the model project, and to false, if you need to run it manually.
  7. Add a child IndividualFiles element and set its value to true, if your generator can be run for selected file(s) only through a contextual menu, and to false, if it can only be run for all files in the model.
  8. If your generator is using a database connection then add a child DbConnection element, which should contain a connection string as its value. You can also set it to use the project default connection by using the $(DbConnection) variable as the value.
  9. Similarly, if your generator needs to use any other database related parameters that are specified when setting up a database connection, such as Database, DbCase, DbTimeout or DbExcludeTables, then add them accordingly. Use the corresponding parameters as a value to specify the project default.
  10. For any additional parameter that your generator uses, define the parameter elements as child nodes of the generator. Some of the most common parameters, which are defined in the Xomega common XSL scripts, are AddToProject and LinkIntoProject, which store the relative path to another project, and allow you to automatically add the generated files into those projects either directly or as links respectively.

The following snippet illustrates the XML nodes described in the above steps.
Code:
<XomGenerator Include="$(XomegaHome)Xsl\model_enums_db.xsl">
  <Name>Enumerations from Database</Name>
  <Folder>Model Enhancement</Folder>
  <OutputPath>ImportedEnums/_{Module}_enums.xom</OutputPath>
  <AddOutputToProject>true</AddOutputToProject>
  <IncludeInBuild>false</IncludeInBuild>
  <Database>$(Database)</Database>
  <DbCase>$(DbCase)</DbCase>
  <DbConnection>$(DbConnection)</DbConnection>
  <DbTimeout>$(DbTimeout)</DbTimeout>
  <AddToProject-param>../MyProject/MyProject.Common.csproj</AddToProject-param>
  <AddToProject-desc>A project file to add the generated files to.</AddToProject-desc>
  <AddToProject-category>Output</AddToProject-category>
</XomGenerator>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Copyright © 2009-2022 Xomega.Net. All rights reserved.