views:

113

answers:

4

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?

A: 

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
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
A: 

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

klabranche
The designer will show you an association if you tell it to do so. See my answer.
Alfred Myers
+2  A: 

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

Marc Gravell
hmm... learn something new... :)
klabranche
@Marc: You seem to run faster by foot than me on my bike (see my avatar) ;)
Alfred Myers
+1  A: 

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

Alfred Myers