Visual Studio 2008 Class Designer - many to many associations
Is there a trick for visualizing a many to many assocation in the Visual Studio Class Desi开发者_运维知识库gner? I have an Employee entity and a Team entity. So each entity has a list of his counterpart.
Associations are possible to show in the Class Designer, but only for 0..1 mulitplicity.
Or does anyone has experience with VS 2010 and the new architecture class diagram? What I miss there is the generated classes oO ... where they are?!
You can do it on VS 2008
I tested it with 2 classes:
public class Team
{
public List<Employee> employees { get; set; }
}
public class Employee
{
public List<Team> teams { get; set; }
}
Added these classes to the diagram, expanded them to show class members, and then selected "Show as Collection Association" (twice). It then shows a diagram with 2 arrows
The UML class diagram in VS 2010 Ultimate supports many-to-many associations. You need to set the Multiplicity property on the First Role and Second Role properties of the association.
For more info, see this topic: Properties of Associations in UML Class Diagrams
Multiplicity (3):
1: This end of the association always links to one object. In the figure, every Menu Item has one Menu.
0..1: Either this end of the association links to one object, or there is no link.
*****: Every object at the other end of the association is linked to a collection of objects at this end, and the collection may be empty.
1..*: Every object at the other end of the association is linked to at least one object at this end. In the figure, every Menu has at least one Menu Item.
n..m: Each object at the other end has a collection of between n and m links to objects at this end.
I've posted more links on my profile for more info about VS 2010.
精彩评论