Member-only story

How to Make Your Solution Architecture Unbreakable in C#

René Reifenrath
8 min readMar 3, 2024

Not a Medium Member? Read here for free.

In this article, I want to draw attention to an easy approach to enforcing software architecture in multi-layered C# solutions. A Ulysses pact if you will, that keeps you and your team from layer leaking. I won’t use any 3rd party library just an underestimated feature .NET already possesses.

Disclaimer

Friend Assemblies should be used with caution and in the right context. While it is, in my opinion, a great solution for big monolithic (or module-lithic) solutions, where refactoring the assembly design itself is not an adequate option, it can lead to bad practices if you use it on green field projects. You can read more about that and other alternatives here.

The Problem

Using DDD or other multi-layer software architectures in a big software solution can be hard to maintain over time. New projects get added to the solution and entropy grows and grows. The code might get more and more confusing and the architecture harder to understand. One dark rainy day a developer might ask themself:

And that bearded old man who designed the architecture might not be there to prevent such a mistake. Then as the broken window theory suggests, it’s getting even worse from here and…

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Written by René Reifenrath

I am a software developer from germany. Blogging about programming and tech related topics. I ❤️ open source and privacy.

Responses (1)

Write a response

A problem is that most people put interfaces and their implementations in the same assembly, for example your Infrastructure assembly. A friend assembly ( for example Usecases assembly) then not inly has access to to the Infrastructure interfaces…

--