Wednesday, 04 July 2007

The Genome OQL Query Analyzer (QA) is a very helpful tool when you are developing with Genome: it allows you to load a mapped business layer to execute any kind of OQL queries. Besides displaying the results in a fully browsable object graph, you can also see the SQL generated by Genome from the OQL you specified. If you haven‘t worked with Genome QA so far, the following screen shot should give you an idea of how it works:

A common workflow when developing with Genome is to develop and debug queries in QA, while extending the domain model with new mappings and query logic.

Since QA loads up the mapping assembly and the business layer with all dependent assemblies, you cannot recompile your solution as long QA is open. It can be a little bit tiresome to restart QA after each compilation while developing your business layer.

Integrating Genome QA in your project

Genome QA can be started with a single click in Visual Studio’s solution explorer, whereby the latest compiled business layer is loaded along with its mapping.

  1. After the first compilation, manually start Genome QA and browse to your solution’s DataDomain schema project folder and select your business layer’s mapping assembly. You also need to specify the connection string to the database you want to use for development (select File – Connect in the menu in QA):
  2. Add the necessary namespaces to execute your OQL statements within (using File – Namespace usings):
  3. Save the DataDomain specification in the business layer project’s folder (using File – Save Connection As ...).
  4. In Visual Studio, select the business layer project in the solution explorer and click on the Show All Files icon below the solution explorer title bar (the second icon from the left). The tree of the business layer project should now show additional files included in the business layer project directory, including the .ddspec file which you have saved in step 3.
  5. Right-click on the .ddspec file and select Include in Project in the context menu.
  6. Right-click on the file and select Open With, which prompts the following dialog:
  7. Select Add and register Genome QA (QA.EXE, located in the Genome installation bin folder):
  8. Select Set as Default for the newly added “Genome OQL-QA” in the list:

Once you have done this, double clicking on the .ddspec file in solution explorer will start Genome Query Analyzer with the latest compiled business layer. Before you recompile, simply close QA, and restart again in the solution explorer once compilation is completed:

To set this up in further projects, you just need to execute steps 1-5, as Genome QA is then already registered as default editor for .ddspec files in the Visual Studio environment.

Posted by Chris

Technorati Tags: object relational

Genome | OQL
Comments are closed.