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

CSharpInteractiveConsole

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 […]

[NoBrainer] Connecting Enterprise Architect Interfaces with PowerShell

Enterprise Architect ProvidedInterface

In one of our projects we needed to create a lot of components that expose interfaces. The steps to design this in EA are quite tedious: Link the Interface to the diagram of our component. Create a ProvidedInterface and attach it to the component Set the name of the ProvidedInterface to the name of the […]

[NoBrainer] Automating Sparx Enterprise Architect with PowerShell

Enterprise Architect Class Diagram

It has been some time since I have last posted something on our blog, so I will start with something easy: today I made the switch from Sparx Enterprise Architect v13.5 to v14.0. And yes, it really paid off since I now can actually decipher all those small connector icons on my Surface Book 2 […]

[NoBrainer] Adding meaningful error messages when using Contract.Result in C#

CodeContract error message

We at d-fens use Microsoft Code Contracts every day. And certainly with every great tool there are some things that might benefit from some improvement – and code contracts are no exception. There is one particular annoying thing in that the error message for Contract.Result exceptions strips the generic parameters from it. This in essence […]

Getting Instance by Type Name in StructureMap

Ever since we are using StructureMap we are also using this as a cheap replacement for Managed Extensibility Framework (MEF), as it allows us to scan arbitrary assembly paths for additional types to inject. As we are also dealing with configuration sections where we specify which plugins or types we want to use in a […]

[NoBrainer] Cascading Lambda Expression in C#

While Converting ODataQueryOptions into LINQ Expressions I needed to cascade different Lambda Expressions via AND and OR. In this post I describe a way on how to easily combine them via a boxing class with operator overriding. The Problem Cascading lambda expressions should be as easy as using a + or && operator: A boxing […]

[NoBrainer] Strongly typed caching with System.Runtime.Caching.MemoryCache

Caching with C# has become easy since the MemoryCache component is included in the .NET framework. While this implementation provides only limited functionality it is actually quite easy to make it strongly typed and support for constructing unique cache keys per cache group. In this post I will show you how this can be done […]

[NoBrainer] Running ad-hoc benchmarks with BenchmarkDotNet and C# Scripting (CSI)

Creating benchmarks with BenchmarkDotNet is very easy and running them is even easier with the Visual C# Interactive Compiler (CSI for short). If you need more information about CSI, read Essential .NET – C# Scripting to get started). And here is how it works: Select the Developer Command Prompt for VS2015 from the Start Menu […]

[NoBrainer] C# and IEnumerable.ForEach

By default we cannot use ForEach() on IEnumerable but only on List. However, with extension methods to the rescue, it is easy to roll your own: Regarding the implementation I saw a few options: I could implement ForEach() with a traditional for loop, parallelise the operation, use ToList() to convert the list or other LINQ […]

[NoBrainer] Start-Sleep takes longer that it seems

While doing some tests with our new TraceListener and log server I did some tests where I wanted to find out how long the log server would take to start accepting messages. So I started to constantly send messages from the console: When I looked at the server logs I noticed that the arriving messages […]