Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / entity-framework

Visualization in VS2010

2.50/5 (2 votes)
4 May 2010CPOL2 min read 10.5K  
If you have Visual Studio 2010 Ultimate, you have some serious architectural tools. One of my favorites (so far) is the Dependency Graph.Select Architecture-Generate Dependency Graph and you'll see that you can generate a graph by Assembly, Namespace, Class, or Custom. Try the Assembly...
If you have Visual Studio 2010 Ultimate, you have some serious architectural tools. One of my favorites (so far) is the Dependency Graph.

Select Architecture-Generate Dependency Graph and you'll see that you can generate a graph by Assembly, Namespace, Class, or Custom. Try the Assembly graph, and you'll see a visual representation of the relationships between the assemblies in your solution. You'll also see the relationships between those assemblies and third-party assemblies, as well as dependencies on the .NET Framework itself.

The real power comes in using this tool to understand the architecture of existing assemblies and frameworks. Try this:

1. Select Architecture-New Diagram
2. Select Directed Graph Document from the list
3. In the Architecture Explorer pane below, click Select Files
4. Find the System.Data.Entity assembly. It should be in C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.Entity.dll
5. Double-click System.Data.Entity in the Architecture Explorer pane after selecting it from the file system.

You will now see three boxes: System.Data.Entity, Generics, and Externals. Click arrows in the top right of the System.Data.Entity box. Voila! You now have a completely navigable view into all the namespaces that make up Entity Framework! These blue-colored boxes are namespaces. Open one up and you'll see the classes in that namespace. The graph can get quite large, so hold down the Ctrl key to pan and scroll in and out.

Select any class and you'll see the arrows connected to it light up. Hover over one of those arrows and you can navigate to the opposite endpoint. This is a great way to understand how an assemblies, namespaces, and classes interact with their dependencies.

You can now dig into Entity Framework and understand how LINQ Providers work from an architectural perspective. Try it on other framework assemblies, then try it on your own. You can share these graphs with users of Visual Studio Premium (they can view and navigate the graph but not edit.) You can also export them to PNG and use them for colorful wallpaper if you have a plotter! :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)