[NoBrainer] Simplifying Sparx Enterprise Architect Development with C# Interactive (CSI)

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 interctively code 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:

  1. Start a C# Interactive Console
  2. Load all required assemblies via the #r syntax
  3. Add some using statements you will need.
  4. Instantiate an EA.Repository class and open a repository.
  5. (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.

CSharpInteractiveConsole

C# Interactive Console (CSI)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: