pierre3 / PlantUmlClassDiagramGenerator

This is a generator to create a class-diagram of PlantUML from the C# source code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better name for generic classes

mpashkovskiy opened this issue · comments

Names like List`1 causes messy visualisations like following:

image

Is it possible to generatenames like List`[FieldName] (eg List`AuditRecords)? Or maybe there is another way to generate better diagrams?

I think that in class A, all fields and properties of type IEnumerable<B> should be rendered with an association between A and B.
The pain is that the parser doesn't know that List<B> implements IEnumerable<B>. We need to compile the source code and then we could use reflection to inspect types and inheritance.
ClassDiagramGenerator inherits from CSharpSyntaxWalker but I think that is not enough to be able to generate a useful class diagram with right associations.

Worked on it on my fork, proposition of pull request incoming

Another suggestion to solve these messy references: Could we have an option to specify classes (e.g. all built-in .NET classes or a list) that are not referenced as a separate element? Properties/members of this types would then be displayed in the referencing class, like
AuditRecords: List<AuditRecord> <<get>> <<set>>
This does not change displaying generic type names, but diagrams with List and Dictionary become a lot cleaner. Besides, we also have the messy reference problem with the built-in DateTime, which is not a generic class.