3

Assume that class Being has a property of type Habitat. Both classes are implemented in their own .cs files. When I drag and drop the two classes from the class designer onto a new Class diagram, I do not see an association line from Being to Habitat, whereas there is an association in code. Am I doing something wrong, or this simply isn't implemented in VS yet?

Alfred Myers
  • 6,384
  • 1
  • 40
  • 68
Andrei Tanasescu
  • 638
  • 1
  • 7
  • 15

4 Answers4

2

To show the property connection, right-click on the property; "show as association" or "show as collection association" (as appropriate)

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
1

It's off by default. Right click on the property and choose "Show as association"

Alfred Myers
  • 6,384
  • 1
  • 40
  • 68
0

The class diagram doesn't show "lines" between every instance (property) of a type and its type. This would get very, very messy very quickly.

If "Being" derived from "Habitat" (which wouldn't make sense), it would show a line for that. It shows lines for inheritance, not each individual field/property.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • You described the default behavior, but as I said on my answer you can turn "Show as association" on for those properties you want. – Alfred Myers Aug 22 '09 at 17:06
0

Habitat is a property in Being. They are not associated in the way the designer shows. The designer shows inheritance.

Kevin LaBranche
  • 20,908
  • 5
  • 52
  • 76