One nice feature that Visual Studio 2010 provides is generating sequence diagrams on the fly. Just point out method and choose diagram generating option from context menu. In this posting I will show you how to generate sequence diagrams on the fly.
To keep example illustrative and simple I will use simple code. Let’s suppose we have ASP.NET MVC application with following controller.
public class PriceEnquiryController : Controller
// ... some properties and methods ...
public ActionResult Index()
var model = new PriceEnquiryListModel();
model.PriceEnquiries = PriceEnquiryRepository.ListPriceEnquiries();
You can select what kind of calls you want to include and exclude. Setting these options you can make diagram to reflect only those parts of your code that you really need to visualize.
If you look at the image you see that you can also set call depth. With more complex methods it may be very helpful because too large call depth causes huge diagram with too much knowledge on it.
When we are done with options we have to click “OK” button and Visual Studio 2010 generates sequence diagram. You can click on image to see it in original size.
This diagram is pretty simple and primitive but you can also generate more complex diagrams. Just set options you need and let Visual Studio 2010 generate – it works like charm. Let’s hope we get more diagrams when Visual Studio 2010 first stable version is released.