VS 2010 Class Designer not rendering relationships correctly - visual-studio

I'm using the Visual Studio 2010 Class Diagram designer and it does a nice job of showing relationships between a parent class and the classes that make up the properties of the parent. In the below sample, we can see that the IFoo interface has a property named Bar which is of type IBar.
However, if I add existing classes, interfaces, etc... that were created outside the designer it does not show the relationships. See sample below...
The code is all the same; and correct; but the representation on the design surface is different. For existing classes, is there a way to instruct the designer to make the correct links without having to manually recreate the items using the designer?

I wasn't able to find a way to do it for the whole diagram, but I did find a Property level context-menu item (e.g. Show as Association) which fixes it one Property at a time.

Related

How to display all class and its base classes members in Visual Studio?

How to display all class and its base classes members in Visual Studio while in the text editor? What I do is go into any method and type 'this.'. and look at what intellisense displays. Is there an easier way?
I use Resharper.
You can use the Hierarchies tool window, which will show the type hierarchy of the currently selected type. You can select each node in the hierarchy and display a preview, which will optionally consist of either the members defined at that point in the hierarchy, or all inherited members.

How to use an IEnumerable<T> business object as RDLC datasource, the way it REALLY works?

I have the hardest time creating an WebForms RDLC report with my business objects, in Visual Studio 2010. I am using the designer to build my report.
In the Report Data View of VS2010 I select New/Dataset... Strange enough, the Data Source Configuration Wizard immediately pops up, covering the Dataset Properties dialog.
When I cancel the Wizard, I am able to manipulate the Dataset Properties dialog somewhat, but none of my business objects does show up. Actually, nothing selectable shows up at all.
What do I need to have my business object selectable?
Note: Earlier in the project, this once worked. I must have changed something, but what?
I have read this question, but my Dataset is in the same project, on the ASPX-Page's code behind file. I have set it up like so:
public IEnumerable<MyDto> Getxy() {
return new List<MyDto>(); //TODO later use real data.
}
I have also read this one but my object already matches what's suggested there. It is a really simple POCO DTO's with no constructor (which makes it automatically have a public parameterless constructor)

Show my own Methods/Properties of a MS .NET class always at top in Intellisense in Visual Studio 2010

I have a UserControl and I put some public Methods/Properties in there.
I would like to have that when the user of my UserControl types something and Intellisense opens, that he immediately sees my custom methods created in the UserControl, is that possible somehow by marking the methods/props with kind of attributes?
No, this is not something that can be easily done. Visual Studio will sort the methods/properties alphabetically.
To do what you want, you will need to:
Mark your methods/properties with a custom attribute
Write this custom attribute
Use VS automation to reflect over every type to find this attribute
Reorder the intellisense listing (not sure if this is even possible with VS VBA)

What ListBox like control is used in Collections Editor of Visual Studio

I need to create a from which uses the same ListBox as the one from Collection Editor of Visual Studio (The ListBox under the Members label). Please, explain exactly which WinForms control is this and which of its properties are set?
You can see the control I am asking about under the Members: label of every collection editor form in design time of Visual Studio.
Thank you.
Hopefully this can get you started. There's other (probably better...) samples out there, but this is a basic starter which can help you get the concept:
http://msdn.microsoft.com/en-us/library/9zky1t4k%28VS.90%29.aspx
Quote:
This example shows how to create a
control named ContactCollectionEditor
that implements a custom collection
editor. The example shows how to
specify the exact type of the object
that a page developer can add to the
control's collection property when
using a custom collection editor. You
associate a collection editor with a
collection property (or the type of
the property) by applying the
EditorAttribute to the collection
property of the control.

Can not generate a class diagram from a project referencing a web service in Visual Studio 2008

I have a question concerning the class generation in Visual Studio 2008.
I use a web service which is added using Add Web Reference. It works great and all the classes seem to have been generated successfully. When I try to generate a class diagram using View Class Diagram for the project which uses the web service, I get:
Some of the selected type(s) cannot
be added to the class diagram. Check
the code for errors and ensure that
all required assemblies are
referenced
I have followed both of these suggestions, and the project has no errors or warnings. I get no error for other projects in the same solution which do not use any web service.
The web service http://foo.bar.com/wsdl/ in a bit anonymized form (though it still has the same structure, I just changed some names) can be found here if it is important for the answer: http://pastebin.com/rd7W9BA6
Append
As an example if I double left-click on class Age inside the WebService folder (in the tree) in Class View I get to see the public partial class Age in the file Reference.cs.
I can see the above Age class in Object browser as well.
It really seems like I have all the necessary information to build a class diagram. But when I right click on said class and choose View Class Diagram I get the error message quoted above.
If I right click any other class, which is not in the WebService folder, and choose View Class Diagram I get to see the diagram for the clicked class. So it must have something to do with it being generated from a WSDL-file.
Right click the project and choose Add Existing Item. Add the Reference.cs file to the project.
Now View Class Diagram for the entire project works as the Reference.cs-file may be accessed by the class diagram generator.
The downside is that you have a generated file as part of your project. And that it won't stay up to date as it is being copied when added. Thus this solution is really only to be used when in need of a class diagram, and then the added (copied) Reference.cs should be deleted as you will step in to conflicts if you don't. When you delete it, those classes are marked as unavailable in the class diagram. So export it as a picture first.

Resources