English 中文(简体)
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 Designer? 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.

Multiplicity values on a class diagram

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.





相关问题
How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Trouble with VS.PHP installing it s own Apache server

I tried installing VS.PHP some time ago. I was intent on seeing how it works with my current setup. I immediately encountered trouble: none of my sites wanted to render. On windows, I m using WAMP ...

Jquery and Intellisense in VS 2008 with hotfix and SP1

I followed Scott Guthrie s instructions as outlined at http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx but no avail: intellisense still doesn t work. Any tips?

Fixing "error C2065: undeclared identifier"

First off, I m completely out of my depth here. So the question might be the wrong one to ask, but here goes... As per the accepted answer to this question, I m trying to compile the bindings for the ...

View whitespace in VS2008

After Jeph most recent post: http://www.codinghorror.com/blog/archives/001310.html, I thought to myself it would be fun to see if any of my code has those trailing whitespaces. So I open Visual ...

热门标签