In the previous chapter, you learned how to add your own application prototypes to the Application Designer toolbox by selecting one or more items on the diagram and choosing the Add to Toolbox popup menu option. You can do exactly the same thing with Logical Datacenter Designer—for example, to add combinations of configured zones and servers to the toolbox as reusable prototypes.
When you define a zone or logical server using the prototype you created, it will be identical to your original, apart from the name. Connections from outside a zone will have been removed, but connections within a zone will have been retained, as will all settings and constraints applied to servers within the zone.
You can achieve something similar simply by copying and pasting (Ctrl+C, Ctrl+V) zones between diagrams, although by using that technique you would not have a prototype to use in other modeling sessions or to share with other developers.
When you invoke the Add to Toolbox feature, a dialog box will prompt you to name the new prototype. This name will determine the file (with extension .lddprototype) in which the prototype is stored; and just as with Application Designer, these prototype files may be shared with other users simply by distributing the files.
The new item will be added to the toolbox under the currently active node—for example, under Endpoints (if you previous used an Endpoint item) or under Logical Servers (if you previously used a Logical Server item). This can take some getting used to as you can easily create a reusable server prototype inadvertently under the Endpoints node.
You might take advantage of this feature as an aid to building multiple logical datacenter diagrams representing alternative deployment scenarios. Though these diagrams would have subtle—or substantial—differences, they would most likely share a high degree of commonality in terms of key zones and servers. You don't want to draw and configure the otherwise identical aspects on every diagram individually, do you?
In the context of our running example, we can identify the StockBroker zone as being an essential element of any deployment scenario for our application. Whereas the MarketMakerZone, the StockMarketZone, and even the ClientZone may well be outside of our control and in the hands of external organizations, the StockBrokerZone and its StockBrokerServer will surely be a consistent feature as the host for our core business logic.
For that reason, we'll use that zone as a good candidate for a new prototype and we'll add it to the tool- box by right-clicking the zone and choosing Add to Toolbox from the pop-up menu. If you do that now, you'll be prompted for a name, so use "StockBrokerZone."
You'll then be prompted to save the prototype definition in a file named StockBrokerZone .lddprototype, in a folder populated with other prototype definitions.
Once you've added that new prototype to the toolbox, you could trying creating a brand-new logical datacenter diagram, onto which you could place the new prototype as a starting point.
Once you've developed some useful prototypes, why keep them to yourself? Because prototypes are stored in files with extension .lddprototype, you can share the prototypes with your team by exchanging those files. They will appear in the toolbox the next time a distributed system solution is opened.
Alternatively, you can copy the prototype files to a shared folder on the network, thus making them accessible to everyone. To make this work, you will have to add a registry entry as follows:
Run regedit from the Windows Start menu.
Navigate to the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\ 8.0\EnterpriseTools\DesignerPrototypeFolders.
Look at the entry PrototypesFolder1=C:\Program Files\… and add a new entry PrototypesFolder2=\YourSharedFolderPath\.
You can test the principle without a network simply by specifying an additional folder on your local machine, such as C:\Prototypes\, where you have placed one or more .lddprototype files.
You must include a trailing slash (\) in the folder name; otherwise, the shared prototypes will not appear in the toolbox.