private static void RenderClass(StringBuilder stringBuilder, TypeDescription type) { #region awesomesauce var stereotype = "entity"; CustomSpot?customSpot = null; if (type.IsClass() && type.Namespace.Split('.').Contains("ValueObjects")) { stereotype = "value object"; customSpot = new CustomSpot('O', "LightBlue"); } else if (type.IsClass() && type.ImplementsTypeStartsWith("Pitstop.WorkshopManagementAPI.Domain.Core.AggregateRoot<")) { stereotype = "root"; customSpot = new CustomSpot('R', "LightGreen"); } #endregion stringBuilder.ClassStart(type.Name, displayName: type.Name.ToSentenceCase(), stereotype: stereotype, customSpot: customSpot); foreach (var property in type.Properties.Where(p => !p.IsPrivate()).OrderBy(p => p.Name)) { stringBuilder.ClassMember($"{property.Name.ToSentenceCase()}: {property.Type.ForDiagram()}", property.IsStatic(), visibility: property.ToUmlVisibility()); } foreach (var method in type.Methods.Where(m => !m.IsPrivate() && !m.IsOverride())) { var parameterList = method.Parameters.Select(p => p.Name.ToSentenceCase()).Aggregate("", (s, a) => a + ", " + s, s => s.Trim(',', ' ')); stringBuilder.ClassMember($"{method.Name} ({parameterList})", method.IsStatic(), visibility: method.ToUmlVisibility()); } stringBuilder.ClassEnd(); foreach (var propertyDescription in type.Properties) { var property = Types.FirstOrDefault(t => string.Equals(t.FullName, propertyDescription.Type) || (propertyDescription.Type.IsEnumerable() && string.Equals(t.FullName, propertyDescription.Type.GenericTypes().First()))); if (property != null) { RenderClass(stringBuilder, property); // Relation stringBuilder.Append($"{type.Name} -- {property.Name}"); if (propertyDescription.Type.IsEnumerable()) { stringBuilder.Append(" : 1..*"); } stringBuilder.AppendLine(); } } }