Class diagram from already created classes does not show the relationship

Asked

Viewed 379 times

0

When I create a class diagram in VS2017 from existing classes, the relationship link does not appear.

inserir a descrição da imagem aqui

namespace CloudEye.Domain
{
   public class Car
   {
      public CarPlate CarPlate { get; private set; }
      public double Capacity { get; set; }
      public double Consumption { get; private set; }
      public double Autonomy => Capacity * Consumption;

      protected Car () { }

      public Car(CarPlate carPlate, double capacity, double consumption)
      {
         CarPlate = carPlate;
         Capacity = capacity;
         Consumption = consumption;
      }
  }
}

namespace CloudEye.Domain
{
   public class CarPlate
   {
      public string Characters { get; private set; }

      protected CarPlate() { }

      public CarPlate(string characters)
      {
         Characters = characters;
      }
   }
}
  • Do you say Inheritance? because in your code there is an aggregation!

  • Not inheritance, even aggregation. In the diagram there should be a line connecting the class Carplate to the property Carplate CAR-class.

  • 1

    no... the line only appears when there is inheritance... it is a class diagram...not an ER model

  • In fact the relation is of composition. In UML there are symbols for aggregation, composition, simple association, among others. Example But the visual studio apparently cannot identify the relationship between the classes.

  • The VS even has the relationship links, as shows the image The problem is that it is not able to do "Reverse Engineering", i.e., assemble the diagram based on existing classes.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.