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.