Whether this is allowed or not is based on your domain model. Did you model a (reference) relationship from the domain class to itself
If you start with a new language, based on the “minimal language” template you will see an example of this. In this language you will find a relationship “ExampleElementReferencesTargets” that exists between “ExampleElement” and “ExampleElement”.
Also note that there are “connection builders” and “connectors” (in the DSl Explorer window) that are related to the domain relationship.
How to prevent a cyclic relation
Mel V
Ricardo,
Whether this is allowed or not is based on your domain model. Did you model a (reference) relationship from the domain class to itself
If you start with a new language, based on the “minimal language” template you will see an example of this. In this language you will find a relationship “ExampleElementReferencesTargets” that exists between “ExampleElement” and “ExampleElement”.
Also note that there are “connection builders” and “connectors” (in the DSl Explorer window) that are related to the domain relationship.
Hope this helps.
Edward
Headon01
[ValidationMethod(ValidationCategories.Open | ValidationCategories.Save | ValidationCategories.Menu)]
private void ValidateOneToOneValidity(ValidationContext context)
{
OneToOneRelation oneToOneAsSource = OneToOneRelation.GetLinkToOneToOneTarget(this);
if (oneToOneAsSource != null)
{
if (oneToOneAsSource.Source == oneToOneAsSource.Target)
{
context.LogError(
String.Format(
"Class {0} cannot have one to one relation with itself",
oneToOneAsSource.Source.Name),
"AW001ValidateOneToOneWithSelf1Error", oneToOneAsSource.Source);
}
else
{
OneToOneRelation oneToOneAsTarget = OneToOneRelation.GetLinkToOneToOneTarget(oneToOneAsSource.Target);
if (oneToOneAsTarget != null && oneToOneAsTarget.Target == this)
context.LogError(
String.Format(
"Class {0} and {1} have a circular one to one relationship",
oneToOneAsTarget.Source.Name, oneToOneAsTarget.Target.Name),
"AW001ValidateOneToOneWithSelf2Error", oneToOneAsTarget.Source, oneToOneAsTarget.Target);
}
}
}