The simplest way to create a software architecture model is to write a single C# program that first creates the model elements (people, software systems, containers and components) before subsequently creating the required views and uploading the workspace to Structurizr. If you have a particularly large model, or you'd like to share common elements between models, then one approach is to modularise your program appropriately.
Another approach is to write a collection of C# programs, that are each responsible for creating a different part of the software architecture model. This is especially useful if you need to use the component finder with different assemblies. You can then write a script, or use your build script, to run these C# programs in sequence. Intermediate versions of the workspace can be saved to and loaded from disk using the WorkspaceUtils class. For example:
- Program 1: Create the basic model elements (people, software systems and containers) and the relationships between them.
- Program 2: Add components for container 1 (e.g. run the component finder).
- Program 3: Add components for container 2 (e.g. run the component finder with a different assembly path).
- Program 4: Create views.
- Program 5: Add styling.
- Program 6: Upload to Structurizr.
In this example, the first program would write the initial version of the workspace to a local file on disk, which subsequent programs then load and add to, before writing the workspace back to disk.