Generate UML diagram from C# class

2019-02-18 02:42发布

问题:

I have nHibernate-generated classes functioning as the BO for an MVC project persisting to a SQL db. I'd like to render the existing code into UML diagrams so I can start playing around with code gen utilities.

Similar to what's asked here only for SQL/nhibernate - SO suggests Tools for generating UML class diagram from C# source or dll and that's really very close - except the last answer there is all of 2 years old. Surely the body of knowledge has expanded since.

回答1:

No tool is required:

  • Right-click your project name, then select View Class Diagram, which will automatically generate a list of all your classes.
  • After that, I'd delete any classes that you don't care about, and expand the ones you do care about.

I'm assuming you're using Visual Studio 2010.