Developing an AddIn for Sparx Enterprise Architect is tedious, even with the existence of support such as the great work of Geert Bellekens. However, since Visual Studio 2015 we can […]
Developing an AddIn for Sparx Enterprise Architect is tedious, even with the existence of support such as the great work of Geert Bellekens. However, since Visual Studio 2015 we can use the C# Interactive Console which allows us to fire up an instance of Enterprise Architect and test our code interactively before putting it into classes and methods.
Note: I am not advising not to use Unit and Integration tests and to only rely on interactive tests. Not at all! But I found for myself that “playing around” with some API calls or figuring out how various elements in the EA API belong together went much faster than running unit tests and having to restart EA for every code/compile/test run.
So what do we need to start working in Visual Studio interactively with EA? It does not take much:
Start a C# Interactive Console
Load all required assemblies via the #r syntax
Add some using statements you will need.
Instantiate an EA.Repository class and open a repository.
(optional) Show the main EA window
To facilitate the process of instantiating an EA.Reporitory class I use a RepositorySingleton class which you find below. It accepts a path to an EA reporitory file and also implements IDisposable so we can correctly terminate a running EA instance.
So this is really all it takes to speed up your C# development with Sparx Enterprise Architect.
Note: I tested with VS 2017 v15.8.7 and EA 14 v14.0.1422.