Using architecture Diagram with visual studio ultimate 2010, architecture check

We create a simple 3 Layered architecture application with presentation layer for GUI, business Layer to do our business process and Data Access Layer to get our data from different source. The purpose is to check that each layer call the layer below and if not a tool (here architecture diagram ) can detect that someone doesn’t follow architecture rules.

The solution explorer show three project (one console project as presentation layer and the two others are library project:


The DataLayer project contains Data.cs file where data access is implemented:


the business layer in a process call data access layer to make some work:


with a reference on Data access layer assembly


finally, the presentation layer call the business process and show result in a console output:



with a reference on layer below that is business layer



use Architecture ->Generate Dependencices diagram by Assembly :



you obtain a dependency graph:


we see that Presentation Layer calls business which calls DataLayer.

We want to set architecture rules, so go to Architecture -> new diagram and select Diagram Layer:


click ok and set a name to your model project which appears in our solution explorer:



in toolbox on the left panel select layer and drag and drop on diagram three times as follows:



rename each layers to have presentation, business and data layer:


Drag and drop each project on its layer (Presentation is dragged and dropped on Presentation layer and so on…) a number at the right side of the layer appears to show that the layer is associated to a project 😉


now generate the dependencies we want to keep :


Visual studio create dependencies at layer level for you 😉


arrows show all dependencies (Presentation calls Business which calls Data layer)



Suppose now our software developper friend who call from presentation directly Data by setting a reference on data assembly and call our data method which is prohibited:


You are the architect (waw you have a good job ;-), and you want to quickly check that the architecture is followed and if not you want to have an alert. Go to the Layer diagram, then call Validate from the context menu


Now we have three errors showing where the architecture is not followed as expected:


Correct it by retrieve the modification of your bad friend (code and Data reference if not your bad friend will loose his job and will ask you to let him sleep at your home ;-( ), and run Validate Architecture again:



all is good so enjoy and show this article to your manager to get the ultimate version of visual studio 2010 😉


, , , , ,

  1. #1 par M Belquas le mars 1, 2013 - 8:14

    Tres interessant. Merci de partager

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s

Microsoft System Center 2012

All System Center 2012 products, Service Manager, App-Controller, Orchestrator, Virtual Machine Manager, Configuration Manager, Data Protection Manager, Operation Manager -Boutougha Hassan

Microsoft Windows Server 2012

IT - Windows server 2012 - Hassan Boutougha

Microsoft Hyper-V

IT - Hyper-V - Hassan Boutougha

Microsoft SQL Server 2012

IT - SQL Server 2012 - Hassan Boutougha

%d blogueurs aiment cette page :