Hi,
I'm creating a DSL using the Class Diagram, but I have one 'value property' for my 'ModelAttribute' named 'Reference' that need to be another type(i.e ClassModel) into DSL, so I need a combobox that show all 'ClassModel' into DSL to set the property 'Reference' for correct value, like an 'enumeration' type does.
Example:
Class X
Class Y
Class Z has property 'Reference' that the value can be only 'Class X' or 'Class Y'.
Thanks,
Alexnaldo Santos

Custom type for property
KIV
Hi Alexnaldo
Have a look at athe domain model at http://blogs.msdn.com/photos/garethj/images/584661/original.aspx
Note the reference realtionship between Field and Type and the multiplicity of the relationship.
Binou
MJSaims
Hi Garethj,
But I have many 'fields' in a class, so I need many 'references'.
Class X
Class Y
Class Z
field1 type of X
field2 type of X
field3 type of Y
Imagine a DSL like 'Visual Studio Class Designer'. I need to force the user to select a correct type for fields(1,2, and 3).
Thanks,
Alexnaldo Santos
jackie-xu
Hi Alexnaldo,
That requirement is supported.
If ClassHasField is an embedding relationship with min multiplicity 0, max multiplicty 0 (i.e. zero to many)
Then FieldReferencesType is a reference relationship with min muliplicity 1, max multiplicity 1.
You should then get a property in the property grid when a field is selected which allows you to pick the Type.
Bert Lefever
Paul732887
Hi Alexnaldo,
You can do this by creating a TypeConverter. See this post for more details on it:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=71541&SiteID=1
Hope it helps,
Gerben.
Ori'
Hi GarethJ,
Thanks for you help...
I don't know how to do it. Did you understand what I'm trying to do
If you have a simple example will be very cool.
Thanks,
Alexnaldo Santos
Tim Goodwin
Hi Alexnaldo,
Assuming there is a common base class for X & Y, then you can do this directly in your model.
If instead of having "Reference" as a ValueProperty you instead make it a reference relationship such as "ZReferencesXorY" with left-hand role, "Reference" and right-hand role "Z".
Set the "Reference" role's multiplicity to be singular (either Min1, Max1. or Min0,Max1) depending on whether null is a vlaid value for "Reference". This step is important as we can only generate an automatic picker for a single item in V1.
You should then automatically get a property grid entry on Z with the picker that you wanted.
Hope this helps.
Luiz Ricci
Hi Garethj,
Yes! Thanks...