index > Visual Studio Team System - Domain-Specific Language Tools > How to generate additional property for embedding elements

How to generate additional property for embedding elements


Hi,

Evgeny Popov

Hi Evgeny,

I am not sure if I follow your question. When you make the embedding relationship ContainerHasComponent, a relationship is created (not a DomainProperty) for that relationship. Since FileComponent inherits from Components, you should be able to use either DomainClasses as targets of the relationship (as long as you also make a Toolbox element corresponding to the FileComponent). There is no need to create an extra relationship for your derived classes.

Hope this helps.

Bhavin B

DSL Tools - SDET

Bhavin B

Hi Bhavin,

Actually, I just want to have an aditional property in a generated class wich represent a Container domain class. The reason is to have a filtered by the type list of components. I mean, for example, when I use T4 templates, I have an instance of my model element and I can obtain the list of all components by this way - this.MyModel.Container.Components. But if I need only a FileComponent component I have to get all of them and then filter them in a code, instead of having a new property like this this.MyModel.Container.FileComponents.

I hope now I make it clear.

Evgeny

Evgeny Popov

Hi Evgeny,

We use derived relationships to implement this type of functionality - unfortunately, they don't really work in the shipping CTPs in the DslDesigner - they will however work correctly in the V1 code.

What you'll do is to make a second relationship between Container and FileComponent "ContainerHasFileComponents".

You'll then set the base class of "ContainerhasFileComponents" to be "ContainerHasComponents"

This should give you exactly the behaviour you desire. You'll probably want to set the "IsPropertyGenerator" flag to false on the target roleplayer of the derived relationship as the base relationship will generate you a "Container" property fot the parent relationship.

The one thing you need to be aware of is that it is still possible to create a link of the base type between a Container and a FileComponent as those types are fully type compatible with the both DomainRelationships and the base class is concrete. If you can make Component and FileComponent siblings both derived from an abstract base DomainClass then you can mirror that with an abstract relationship as the aggregate collection and two concrete relationships.




Gareth Jones - Developer - DSL Tools & Software Factories Platform [MSFT]
GarethJ - MSFT
reply 4

You can use google to search for other answers

 

More Articles

Not getting items in the toolbox in the designer instance
Reading and writing models in June release?
Collaborating on models?
Context menu item localization
How to Limit Number of Connectors Between Concepts?
Join the World's Largest Software Factory Users Group is VS 2005!
Template Fix: Text templating fails with designers deployed using...
Custom TargetEndStyle
How do I use the DSL that I have created in other .Net projects?
Can i use the DSL Diagram components in other application?
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Label Editing (how to prevent)
TextTemplatingFileGenerator now fails to…
Use of the TextTransform tool
DSL Tools for RTM?
How create an Emf file ? Extending notat…
Has the hosting question been resolved?
Programmatically creating diagrams
How to respond to and propagate changes
IsSerializing property
Announcing: SharpLudus, a software facto…
designer definition toolbox item - compa…
Multiple viewpoints/ zoom in, zoom out
Can I Generate Code with CodeDom in the …
How do I change the color of a connector…
Shape inside a shape

Hot Articles

Adding files generated with text templat…
Localization
circular dependency and custom properties
Making a reference from a connector class
"Static" Swimlanes
November release Designers compile errors
Prevent generated DSL code from producin…
DSL Tools / VS.NET RTM
How can I order compartments within a sh…
Installing June 2006 VS SDK CTP side-by-…
How to make Tree's?
Serialize reference type class member
Multiple DSL's using the same file exten…
Nesting relationships, can't link to Ima…
Custom source for connector

Recommend Articles

Transcript of Web Chat: Using the Domain…
How do I get a new ModelElement's corres…
My view on views, Repositories, Multi-us…
IsSerializing property
Reference relationships without graphica…
Keeping separate models in step
Unable to Start Debugging !!!
Problem Extending Notation with icons
Multi-User Capability
Validation / Rejecting a change from a C…
Dynamically determining link type
How to Prevent property from being displ…
Problems loading package
Walkthrough distinguish visually between…
Is there documentation for the T4 engine…