Reputation: 57469
Are class diagrams in visual studio supposed to show relation between classes, for eg. 1 : many.
public class User
{
public string UserId { get; set; }
public List<Role> Roles { get; set; }
}
public class Role {
public int RoleId {get; set;}
public User User {get; set;}
public string UserId {get; set; }
}
Upvotes: 2
Views: 8058
Reputation: 47510
If you want to show more advanced associations here is an addin for Visual studio from CodePlex.
Upvotes: 2
Reputation: 14600
Edit:
To clarify.. Class diagram generally isn't supposed to show relations (1:n, m:n etc.) because those relations are for database tables (entities). Classic class diagram is more suited for analysis and design, so it shows associations instead of relations.
Original answer:
Yes you can show 'relations', but you wont see any numbers afaik. It has its own way of showing. Numbers are shown in Entity Framework model for example.
How to show associations:
Move classes into diagram, and then right click on property Roles and pick Show as collection association
.
Upvotes: 8