When I generate class diagram in Visual Studio 2008 using View Class Diagram I always get a bunch of class boxes without methods. The only lines in the diagram are inheritance.
Is it possible, and if so how do I get associations (aggregation and composition might not be possible, but at least an association line indicating they are some how connection. Preferably with an arrow) visualized?
And is it possible to change it so that methods are shown after generating a diagram by default?
To show a property as an association just right click on a property in the diagram editor (not the Class Details panel) and choose either "Show as Association" or "Show as Collection Association". Obviously you will need to make the property visible in the diagram editor first. Typically I only show public properties.
And I don't believe there is a way to always show associations.
Related
Under Papyrus 4.2.0, how can I link two instance specifications (as described here or here)?
I created a new class diagram, created two Instance Specifications, and click on the Link entry in the Edges Palette, and when hovering over my instances, the icon says “forbidden”, as when trying to use an edge on something that can’t receive that kind of edge. This is consistent with the tooltip for Link, which says: Creation of a link for comment, constraint, TimeObservation, DurationObservation.
The bug reports 432693, 468588, 444606, 432678 (all but the last fixed long ago) indicate that it is possible to link instances with Papyrus. But how?
The user guide does not mention instances or links.
You have to have two "Instance specification" (object) for example in a class diagram. The objects have to have classifiers. The two classifier have to have at least an association to each other.
Then choose "Instance Specification" tool from the "Edges" palette. Tie them together with the mouse. When the moue button released on the target object, two new window will be opened (with papyrus 4.4.0). The first window completely empty, but the second shows a list with associations between the two classifier. Choose one, and press the "OK" button. The empty window will be remained on the screen. Close the empty window. And voila link created.
I have need of using VBS in conjunction with the DAO.Field.Type methods and properties. Since I am using VBS I do not have access to the constants displayed on this page and I can't find a good resource that will tell me what they are.
Most specifically this MSDN article lists the constant names, but I don't know what their values are, and I would appreciate finding out what they are.
Field.Type Property (DAO)
Thanks,
Sean W.
Do you have Microsoft Office? Here's one way you can find them.
Open any Office product.
Hit ALT+F11 to open the VBA editor.
From the Tools menu, select References....
Find the reference entitled Microsoft DAO X.X Object Library, check it, and click OK.
Hit F2 to bring up Object Browser.
In the top drop-down, choose the DAO library.
In the 2nd drop-down, type your constant name (e.g., dbBigInt) and hit [Enter] to search.
Select the proper item from the search results.
Near the status bar is a pane that describes the selected item. It will show you the constant's value.
We have lot of code like:
IPerson
{
Eat();
}
Persion : IPerson
{
}
IPerson p;
p.Eat();
As most of our interfaces only have 1 or 2 classes that implement them, there should be a way for me to right click on the “p.Eat()” and be taken to the code the in person class. When there is more than one implementer, I wish to be shown a list to choose from.
There is a new feature in Visual Studio 2010, called View Call Hierarchy (Ctrl+K, Ctrl+T).
Right-click on a symbol in code (method name or properties are good) and select View Call Hierarchy, and you will get a new window with various options. On interface members, you will see an 'Implements [member]' option, dropping this down will show you all instances where the interface member has been implemented.
Similar options appear for virtual / abstract members, showing you where they are overridden or implemented.
As an extra bonus, this window also shows 'Calls To [member]' and 'Calls From [member]'.
Resharper is an extremely valuable refactoring tool which provides the behaviour you describe.
I currently right click on the method name in the interface file and select the option 'Go To Implementation'.
I'm assuming this is a Resharper feature and not just Visual Studio 2010 purely because you aren't aware of it. Try right-clicking and seeing if you have the option. If not - I highly recommend getting a refactoring tool with this kind of functionality.
Edit | Find and Replace | Find Symbol will find definitions and references.
Right click on p.Eat() and choose "Find all references". In the Find Symbol Results windows, you may find all of the implementations of that interface method. Double-clicking each item will show up the reference in code editor.
My favorite way to find subclasses of class 'X' or implementations of interface 'Y' has been to use Red Gate's Reflector. But I'd like to know if there is a (free) way to do the same thing from VS 2010. Does 2010 already have this ability? Is there a plugin I can add?
The object browser, the place I might expect this feature to be found, does not seem to have this capability. It can tell you about a parent type, but it does not tell you about derived types.
A more non-straight forward but works in all cases is to temporarily change the class/interface that you are modifying to abstract and add a abstract method.property and rebuild the solution :) all the build errors would point you towards the direct/indirect children.
While I've not found a RedGate Reflector level of functionality for this need, I have started using a partial solution. Using the regex search capability in VS, I enter the following:
\:.#<place base class or interface here>
Example:
\:.#MyBase
Any derivative interface or class made from "MyBase," defined in the solution, will be returned.
I've just found free Inheritance Margin Extension.
With this I can view inheritance info right in the code editor and also navigate to base/overridden items (with right mouse click on the inheritance glyph).
I have designed a class (in UML) which should implement the System.IDisposable interface. How do I do it so that when generating code it get's recognized properly and withou having to draw my own "System" package with some "IDisposable" interface in it?
Thanks for your help! Cheers, David
I discovered to do it as follows:
The clean (slightly overkill) variant:
Open Architecture -> Windows -> Architecture Explorer
Browse thru to find the class/type you need. In this example Saved DGQL Queries -> All Assembly References → mscorlib.dll → IDisposable
Draw IDisprosable onto white ground (The System package will be generated, the IDisposable will be generated inside and all other stuff which is needed from the framework is added to the model tree (but not drawn))
Use the smart connector to connect IDisposable element to your entity
The smart way (if you know in which namespace the desired element is placed and how it "looks" like):
Open Architecture -> Windows -> Architecture Explorer
Right click on "Modelling"
Select "Add -> Package".
Name it "System"
Add an interface underneath and name it "IDisposable"
Add an operation "Dispose()"
Now you have a dummy.
Say if you want to add an attribute to a class that should be of IDisposable, you can select the attribute's property "Type" (Properties window) to be Modelling::System::IDisposable.
In term of "Generating code" I found it clever to place all of my own modelled classes into a package so that it becomes separated from the packages like System. Then you can simply (instead of right clicking on white ground and selecting "Generate code" in order to generate code for all artefacts) right click on your package and select "Generate code" and it will generate code just for your package and not the System stuff (dummies). It becomes valid either way if you have the namespaces set nicely in your model like described in this post.