Monthly Archives: November 2007

Adventures in Extending the Service Factory – Part 2

Here’s a handy tip when you are trying to learn how the components of the Service Factory works. I’ve found it very useful over the last couple of weeks.

 

Since the Service Factory now gets registered under the Visual Studio Experimental Hive you can configure the solution so you can debug it. If you are familiar with debugging DSLs, this should be nothing new. Just follow the steps below:

  1. 1. Set the Service Factory Guidance Package as the Start-Up Project by right-clicking on the project and selecting “Set as Start-Up Project”.
  2. 2. Change the Service Factory Guidance Package Project’s debug settings to launch Visual Studio under the Experimental Hive:
      1. a. Right click on the Service Factory Guidance Package Project and select “Properties”.
    1. b. Select the Debug Tab
    2. c. Configure the Start Action to Start External Program and C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe or where ever you have installed Visual Studio for the program.
    3. d. Set the Start Options, Command Line Arguments to /rootsuffix Exp

 

Now you can set breakpoints in the Service Factory code and press F5 to walk through the code in the debugger.

 

 

Adventures in Extending the Service Factory

I’ve been trying to add a couple of additional projects and item templates to the Service Factory for workflows and workflow activities. I thought I’d try to use the same techniques that the Service Factory was using to dynamically bind the menu options using the ProjectIsInRoleReference helper in the Binding.xml recipe.

 

So I did the following:

  1. 1. Added new roles WorkflowRole and ActivitiesRole to the file WSSF\Modeling.CodeGeneration\Source\Enums\ServiceFactoryRoleType.cs. I did this so that the Project Mapping helpers would incorporate the new roles into the ProjectMappingTable and get picked up by the ProjectIsInRoleReference helper.
  2. 2. Added the project templates to Templates\Projects.
  3. 3. Added the projects to the WCF and ASMX.vstemplate files.
  4. 4. Added new item templates to Templates\Items to use when the user selects the menu option to create a workflow or activity.
  5. 5. Added unbound recipes to unfold the templates. I used the CreateTranslator recipe as an example.
  6. 6. Added actions to the Binding.xml using the RefCreator and the ProjectIsInRoleReference just like the action for the CreateTranslator recipe.

 

When I created a new ASMX or WCF Implementation project, the new projects templates got unfolded without issue. But when I right clicked on either the workflow or activities project I did not see the menu options to launch the recipes on the context menu.

 

At first I thought maybe the ProjectIsInRoleReference helper was not working, but I added debug output to indicate whether it found a match or not and everything was showing up correctly.

 

So I was at a loss as to why the menu options didn’t show up. I even tried to bind the recipes to the projects but still no luck. I dug out the older Extensibility Walkthroughs from the Service Factory CTP and there was an example for adding a new recipe through the binding.xml file. It seems that because we are testing in the Experimental Hive you need to run the following command to reset the context menus:

devenv /rootsuffix Exp /Setup

 

Once I ran the command and then restarted Visual Studio under the experimental hive the menu options showed up.  This behavior is not really apparent and I couldn’t find anything in the GAX/GAT documentation. I think that has a lot to do with the fact that running under the experimental hive is rather new for GAX/GAT and until the Service Factory you had to use the Clarius SFT to run under the experimental hive.