public static bool GenerateSpecificVMHandlerForRole(DomainClass domainClass, DomainRole role)
        {
            if (role.Relationship.InheritanceModifier == InheritanceModifier.Abstract)
                return false;

            if (role.Relationship.Source != role)
            {
                if (!domainClass.GenerateSpecificViewModelOppositeReferences)
                    return false;

                if (!(role.Relationship is ReferenceRelationship))
                    return false;
            }

            //if( !role.IsPropertyGenerator )
            //	continue;

            if (role.Relationship is EmbeddingRelationship && !domainClass.GenerateSpecificViewModelEmbeddings)
                return false;

            if (role.Relationship is ReferenceRelationship && !domainClass.GenerateSpecificViewModelReferences)
                if (role.Relationship.Source == role)
                    return false;

            return true;
        }
Example #2
0
        /// <summary>
        /// Adds a new referece relationship instance.
        /// </summary>
        /// <param name="source">Domain class representing the source.</param>
        /// <param name="target">Domain class representing the target.</param>
        public static ReferenceRelationship AddNewReferenceRelationship(DomainClass source, AttributedDomainElement target)
        {
            // create rs
            ReferenceRelationship refRel = new ReferenceRelationship(source.Store);

            source.ModelContext.Relationships.Add(refRel);

            // create roles
            DomainRole sourceRole = new DomainRole(source.Store);

            sourceRole.PropagatesDelete = false;

            DomainRole targetRole = new DomainRole(source.Store);

            targetRole.PropagatesDelete = false;

            sourceRole.RolePlayer = source;
            targetRole.RolePlayer = target;

            sourceRole.Opposite = targetRole;
            targetRole.Opposite = sourceRole;

            // assign roles to rs
            refRel.Roles.Add(sourceRole);
            refRel.Roles.Add(targetRole);

            refRel.Source = sourceRole;
            refRel.Target = targetRole;

            // properties + names
            if (refRel.Source.RolePlayer.Name == refRel.Target.RolePlayer.Name)
            {
                sourceRole.Name = source.Name + "Source";
            }
            else
            {
                sourceRole.Name = source.Name;
            }
            sourceRole.IsNameTracking = TrackingEnum.IgnoreOnce;

            if (refRel.Source.RolePlayer.Name == refRel.Target.RolePlayer.Name)
            {
                targetRole.Name = target.Name + "Target";
            }
            else
            {
                targetRole.Name = target.Name;
            }
            targetRole.IsNameTracking = TrackingEnum.IgnoreOnce;

            refRel.SerializationSourceName           = sourceRole.Name + "Ref";
            refRel.IsSerializationSourceNameTracking = TrackingEnum.IgnoreOnce;
            refRel.SerializationTargetName           = targetRole.Name + "Ref";
            refRel.IsSerializationTargetNameTracking = TrackingEnum.IgnoreOnce;

            AddNewReferenceRelationship(refRel, source, target);

            return(refRel);
        }
Example #3
0
        /// <summary>
        /// Adds a new embedding relationship instance. Needs to be called within a modeling transaction.
        /// </summary>
        /// <param name="source">Domain class representing the parent.</param>
        /// <param name="target">Domain class representing the child.</param>
        public static EmbeddingRelationship AddNewEmbeddingRS(DomainClass source, AttributedDomainElement target, bool bTargetElementHolder)
        {
            // create rs
            EmbeddingRelationship emb = new EmbeddingRelationship(source.Store);

            source.ModelContext.Relationships.Add(emb);

            // create roles
            DomainRole sourceRole = new DomainRole(source.Store);

            sourceRole.PropagatesDelete = false;

            DomainRole targetRole = new DomainRole(source.Store);

            targetRole.Multiplicity     = Multiplicity.One;
            targetRole.PropagatesDelete = true;

            sourceRole.RolePlayer = source;
            targetRole.RolePlayer = target;

            sourceRole.Opposite = targetRole;
            targetRole.Opposite = sourceRole;

            // assign roles to rs
            emb.Roles.Add(sourceRole);
            emb.Roles.Add(targetRole);

            emb.Source = sourceRole;
            emb.Target = targetRole;

            // properties + names
            if (emb.Source.RolePlayer.Name == emb.Target.RolePlayer.Name)
            {
                sourceRole.Name = source.Name + "Source";
            }
            else
            {
                sourceRole.Name = source.Name;
            }
            sourceRole.IsNameTracking = TrackingEnum.IgnoreOnce;

            if (emb.Source.RolePlayer.Name == emb.Target.RolePlayer.Name)
            {
                targetRole.Name = target.Name + "Target";
            }
            else
            {
                targetRole.Name = target.Name;
            }
            targetRole.IsNameTracking = TrackingEnum.IgnoreOnce;

            AddNewEmbeddingRS(emb, source, target, bTargetElementHolder);

            return(emb);
        }
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                DomainRole domainRole = component as DomainRole;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);

                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    PropertyGridEditor p = modelElement as PropertyGridEditor;
                    bool bFound          = false;
                    foreach (PropertyGridEditor e in list)
                    {
                        if (e.Name == p.Name)
                        {
                            bFound = true;
                            break;
                        }
                    }

                    if (!bFound)
                    {
                        list.Add(p);
                    }
                }
                return(list);
            }
public string GenerateDomainRole(DomainRole role) 
{
	this.GenerationEnvironment = null;
	this.GenerateDomainRoleInternal(role);
	return this.GenerationEnvironment.ToString();
}
// Generate code to access a roleplayer on a relationship instance
private void GenerateDomainRoleInternal(DomainRole role) 
{
	DomainRelationship relationship = role.Relationship;

	// Check to see if domain role has a base domain role with the same name.
	DomainRole baseRole = CodeGenerationUtilities.GetSameNameBaseRole(role);
	
	// Get domain role inheritance modifier.
	string inheritanceModifier;
	switch (relationship.InheritanceModifier)
	{
		case InheritanceModifier.Abstract:
			inheritanceModifier = baseRole != null ? "override abstract " : "abstract ";
			break;
		
		case InheritanceModifier.Sealed:
			inheritanceModifier = baseRole != null ? "override sealed " : string.Empty;
			break;
		
		default:
			inheritanceModifier = baseRole != null ? "override " : "virtual ";
			break;
	}
	
	// Calculate Source/Target specifier for the role.
	string roleOrder;
	if (role == relationship.Source)
	{
		roleOrder = "DslModeling::DomainRoleOrder.Source, ";
	}
	else
	{
		roleOrder = "DslModeling::DomainRoleOrder.Target, ";
	}

	// The type of the role property is defined by the root role with the same name.
	DomainRole typeRole = CodeGenerationUtilities.GetTypeRole(role);
	
	// Generate RolePlayer if it doesn't match the role's type.
	string typeRoleTypeName = typeRole.RolePlayer.GetRelativeName(role.Relationship.Namespace, true);
	string roleTypeName = role.RolePlayer.GetRelativeName(role.Relationship.Namespace, true);
	string rolePlayer = string.Empty;
	if (roleTypeName != typeRoleTypeName)
	{
		rolePlayer = "RolePlayer = typeof(" + roleTypeName + "), ";
	}
	

        
        #line default
        #line hidden
        
        #line 60 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#region ");

        
        #line default
        #line hidden
        
        #line 61 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 61 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" domain role code\r\n\r\n/// <summary>\r\n/// ");

        
        #line default
        #line hidden
        
        #line 64 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 64 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" domain role Id.\r\n/// </summary>\r\npublic static readonly");

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(baseRole != null ? " new" : string.Empty));

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" global::System.Guid ");

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId = new System.Guid(\"");

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Id.ToString("D")));

        
        #line default
        #line hidden
        
        #line 66 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\");\r\n\r\n/// <summary>\r\n/// DomainRole ");

        
        #line default
        #line hidden
        
        #line 69 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 69 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n");

        
        #line default
        #line hidden
        
        #line 70 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	this.Write(Utilities.Instance.GenerateComments(role.Description));

        
        #line default
        #line hidden
        
        #line 72 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// </summary>\r\n");

        
        #line default
        #line hidden
        
        #line 74 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	//GenerateClrAttributes(role.Attributes);
	this.Write(Utilities.Instance.GenerateResourceAttributes(role));
	if(!role.IsPropertyBrowsable)
	{

        
        #line default
        #line hidden
        
        #line 79 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("[global::System.ComponentModel.Browsable(false)]\r\n");

        
        #line default
        #line hidden
        
        #line 81 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	if( role.PropertySetterAccessModifier!=AccessModifier.Public)
	{

        
        #line default
        #line hidden
        
        #line 85 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("[global::System.ComponentModel.ReadOnly(true)]\r\n");

        
        #line default
        #line hidden
        
        #line 87 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	
	string rolePropagatesCopy = "DoNotPropagateCopy";
	if( role.Relationship is EmbeddingRelationship && role.Relationship.Target == role )
		rolePropagatesCopy = "PropagatesCopyToLinkAndOppositeRolePlayer";

        
        #line default
        #line hidden
        
        #line 93 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("[DslModeling::DomainRole(");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleOrder));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(rolePlayer));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
 if(!string.IsNullOrEmpty(role.PropertyName)){ 
        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("PropertyName = \"");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\", ");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
 } if (!string.IsNullOrEmpty(role.PropertyDisplayName)) { 
        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("PropertyDisplayNameKey=\"");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Utilities.Instance.GetDomainRoleResourceKey(role)));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".PropertyDisplayName\", ");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
 } if(role.PropagatesDelete) { 
        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("PropagatesDelete = true, ");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
 } 
        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" PropagatesCopy = DslModeling::PropagatesCopyOption.");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(rolePropagatesCopy));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(", Multiplicity = DslModeling::Multiplicity.");

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Multiplicity));

        
        #line default
        #line hidden
        
        #line 94 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(")]\r\n[DslModeling::DomainObjectId(\"");

        
        #line default
        #line hidden
        
        #line 95 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Id.ToString("D")));

        
        #line default
        #line hidden
        
        #line 95 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\")]\r\n");

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(role.RolePlayer.AccessModifier)));

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(inheritanceModifier));

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(typeRoleTypeName));

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 96 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n{\r\n");

        
        #line default
        #line hidden
        
        #line 98 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	if (relationship.InheritanceModifier == InheritanceModifier.Abstract)
	{

        
        #line default
        #line hidden
        
        #line 101 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\tget;\r\n\tset;\r\n");

        
        #line default
        #line hidden
        
        #line 104 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	else
	{

        
        #line default
        #line hidden
        
        #line 108 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t[global::System.Diagnostics.DebuggerStepThrough]\r\n\tget\r\n\t{\r\n\t\treturn (");

        
        #line default
        #line hidden
        
        #line 112 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(typeRoleTypeName));

        
        #line default
        #line hidden
        
        #line 112 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(")DslModeling::DomainRoleInfo.GetRolePlayer(this, ");

        
        #line default
        #line hidden
        
        #line 112 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 112 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId);\r\n\t}\r\n\t[global::System.Diagnostics.DebuggerStepThrough]\r\n\tset\r\n\t{\r\n" +
        "\t\tDslModeling::DomainRoleInfo.SetRolePlayer(this, ");

        
        #line default
        #line hidden
        
        #line 117 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 117 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId, value);\r\n\t}\r\n");

        
        #line default
        #line hidden
        
        #line 119 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}

        
        #line default
        #line hidden
        
        #line 121 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("}\r\n\t\t\r\n#endregion\r\n");

        
        #line default
        #line hidden
        
        #line 125 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

}
public string GenerateOppositeRoleAccessor(DomainRole role) 
{
	this.GenerationEnvironment = null;
	this.GenerateOppositeRoleAccessorInternal(role);
	return this.GenerationEnvironment.ToString();
}
// Generate code on a domain class to access the opposite role players for a role it plays
private void GenerateOppositeRoleAccessorInternal(DomainRole role)
{
	if(!role.IsPropertyGenerator) 
	{
		return;
	}
	DomainRole opposite = role.Opposite;
	
	// Check if property needs a 'new' modifier on it.
	string inheritanceModifier = (role.Relationship.InheritanceModifier==InheritanceModifier.Sealed || role.RolePlayer.InheritanceModifier==InheritanceModifier.Sealed || (role.PropertyGetterAccessModifier == AccessModifier.Private && role.PropertySetterAccessModifier == AccessModifier.Private)) ? "" : "virtual ";
	string castString = "";
	string propertyType = opposite.RolePlayer.GetRelativeName(role.RolePlayer.Namespace, true);
	DomainRole typeRole = role;
	/*for (DomainRole current = role.BaseRole; current!=null; current = current.BaseRole)
	{
		if(current!= role && current.IsPropertyGenerator && current.PropertyName==role.PropertyName)
		{
			if((current.Relationship.InheritanceModifier==InheritanceModifier.Abstract || role.Relationship.InheritanceModifier==InheritanceModifier.Abstract) && current.Relationship.InheritanceModifier != role.Relationship.InheritanceModifier)
			{
				inheritanceModifier+= "new ";
				break;
			}
			else 
			{
				typeRole = current;
			}
		}
	}*/
	if(typeRole!=role)
	{
		inheritanceModifier = "override ";
		castString = "("+propertyType+")";
		propertyType = typeRole.Opposite.RolePlayer.GetRelativeName(role.RolePlayer.Namespace, true);
	}

	// Determine collection type for the property.
	string linkedElementCollectionType;
	switch (typeRole.Relationship.InheritanceModifier)
	{
		case InheritanceModifier.Abstract:
			linkedElementCollectionType = "DslModeling::ReadOnlyLinkedElementCollection";
			break;
		case InheritanceModifier.None:
		case InheritanceModifier.Sealed:
			linkedElementCollectionType = "DslModeling::LinkedElementCollection";
			break;
		default:
			throw new NotSupportedException();
	}

	
	// Determine access modifier of the property.
	AccessModifier setterAccessModifier = typeRole.PropertySetterAccessModifier;
	AccessModifier getterAccessModifier = typeRole.PropertyGetterAccessModifier;
	AccessModifier overallAccessModifier;
	
	if(setterAccessModifier==AccessModifier.Public || getterAccessModifier==AccessModifier.Public)
	{
		overallAccessModifier = AccessModifier.Public;
	}
	else if(setterAccessModifier==AccessModifier.FamilyOrAssembly || getterAccessModifier==AccessModifier.FamilyOrAssembly)
	{
		overallAccessModifier = AccessModifier.FamilyOrAssembly;	
	}
	else if(setterAccessModifier==AccessModifier.Family || getterAccessModifier==AccessModifier.Family)
	{
		overallAccessModifier = AccessModifier.Family;
	}
	else if(setterAccessModifier==AccessModifier.Assembly || getterAccessModifier==AccessModifier.Assembly)
	{
		overallAccessModifier = AccessModifier.Assembly;
	}
	else 
	{
		overallAccessModifier = AccessModifier.Private;
	}
	
	
	if ( overallAccessModifier == AccessModifier.Public )
	{
		// Make sure the role player modifier complies with the role player modifier settings
		// If role player is internal. We need to change overallAccessModifier to internal as well
		if (role.Opposite.RolePlayer.AccessModifier == AccessModifier.Assembly )
		{
			overallAccessModifier = AccessModifier.Assembly;
			
			if ( getterAccessModifier == AccessModifier.Public)
			{
				getterAccessModifier = AccessModifier.Assembly;
			}
			
			if ( setterAccessModifier == AccessModifier.Public)
			{
				setterAccessModifier = AccessModifier.Assembly;
			}
		}
	}

	

        
        #line default
        #line hidden
        
        #line 285 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#region ");

        
        #line default
        #line hidden
        
        #line 286 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 286 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" opposite domain role accessor\r\n");

        
        #line default
        #line hidden
        
        #line 287 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	if(role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.One || role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.ZeroOne)
	{

        
        #line default
        #line hidden
        
        #line 290 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// <summary>\r\n/// Gets or sets ");

        
        #line default
        #line hidden
        
        #line 292 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 292 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n");

        
        #line default
        #line hidden
        
        #line 293 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	this.Write(Utilities.Instance.GenerateComments(role.Description));

        
        #line default
        #line hidden
        
        #line 295 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// </summary>\r\n");

        
        #line default
        #line hidden
        
        #line 297 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	//GenerateClrAttributes(role.PropertyAttributes);

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(overallAccessModifier)));

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(inheritanceModifier));

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyType));

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 300 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n{\r\n\t[global::System.Diagnostics.DebuggerStepThrough]\r\n");

        
        #line default
        #line hidden
        
        #line 303 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	if(getterAccessModifier!=overallAccessModifier)
	{

        
        #line default
        #line hidden
        
        #line 306 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t");

        
        #line default
        #line hidden
        
        #line 307 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(getterAccessModifier)));

        
        #line default
        #line hidden
        
        #line 307 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" get\r\n");

        
        #line default
        #line hidden
        
        #line 308 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	else
	{

        
        #line default
        #line hidden
        
        #line 312 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\tget\r\n");

        
        #line default
        #line hidden
        
        #line 314 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}

        
        #line default
        #line hidden
        
        #line 316 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t{\r\n\t\treturn DslModeling::DomainRoleInfo.GetLinkedElement(this, ");

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".");

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId) as ");

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(opposite.RolePlayer.GetRelativeName(role.RolePlayer.Namespace, true)));

        
        #line default
        #line hidden
        
        #line 318 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(";\r\n\t}\r\n");

        
        #line default
        #line hidden
        
        #line 320 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		if (role.Relationship.InheritanceModifier != InheritanceModifier.Abstract)
		{

        
        #line default
        #line hidden
        
        #line 323 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t[global::System.Diagnostics.DebuggerStepThrough]\r\n");

        
        #line default
        #line hidden
        
        #line 325 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		if(setterAccessModifier != overallAccessModifier)
		{

        
        #line default
        #line hidden
        
        #line 328 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t");

        
        #line default
        #line hidden
        
        #line 329 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(setterAccessModifier)));

        
        #line default
        #line hidden
        
        #line 329 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" set\r\n");

        
        #line default
        #line hidden
        
        #line 330 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		}
		else
		{

        
        #line default
        #line hidden
        
        #line 334 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\tset\r\n");

        
        #line default
        #line hidden
        
        #line 336 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		}

        
        #line default
        #line hidden
        
        #line 338 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\t{\r\n\t\tDslModeling::DomainRoleInfo.SetLinkedElement(this, ");

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".");

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId, ");

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(castString));

        
        #line default
        #line hidden
        
        #line 340 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("value);\r\n\t}\r\n");

        
        #line default
        #line hidden
        
        #line 342 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		}

        
        #line default
        #line hidden
        
        #line 344 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("}\r\n");

        
        #line default
        #line hidden
        
        #line 346 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	else
	{
		string fieldName = CodeGenerationUtilities.GetCamelCase(role.PropertyName) + "CollectionStorage";

        
        #line default
        #line hidden
        
        #line 351 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n/// <summary>\r\n/// Gets a list of ");

        
        #line default
        #line hidden
        
        #line 354 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 354 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n");

        
        #line default
        #line hidden
        
        #line 355 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		this.Write(Utilities.Instance.GenerateComments(role.Description));

        
        #line default
        #line hidden
        
        #line 357 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// </summary>\r\n");

        
        #line default
        #line hidden
        
        #line 359 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	//GenerateClrAttributes(role.PropertyAttributes);

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(typeRole.PropertyGetterAccessModifier)));

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(inheritanceModifier));

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(linkedElementCollectionType));

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("<");

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyType));

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("> ");

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 362 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n{\r\n\t[global::System.Diagnostics.DebuggerStepThrough]\r\n\tget\r\n\t{\r\n\t\treturn GetRol" +
        "eCollection<");

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(linkedElementCollectionType));

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("<");

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyType));

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">, ");

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyType));

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">(");

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".");

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 367 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId);\r\n\t}\r\n}\r\n");

        
        #line default
        #line hidden
        
        #line 370 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}

        
        #line default
        #line hidden
        
        #line 372 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#endregion\r\n");

        
        #line default
        #line hidden
        
        #line 374 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

}
// Generate overrides of the base role accessor
private void GenerateDomainRoleOverrideInternal(DomainRole role)
{
	DomainRelationship rel = role.Relationship;
	DomainRole baseRole = CodeGenerationUtilities.GetBaseRole(role);
	if (baseRole != null && baseRole.Name != role.Name)
	{
		DomainRole typeRole = CodeGenerationUtilities.GetTypeRole(role);
		string roleType = typeRole.RolePlayer.GetRelativeName(typeRole.Relationship.Namespace, true);
		
		DomainRole baseTypeRole = CodeGenerationUtilities.GetTypeRole(baseRole);
		string baseRoleType = baseTypeRole.RolePlayer.GetRelativeName(rel.Namespace, true);
		
		string typeCast = roleType != baseRoleType ? "(" + roleType + ")" : string.Empty;
		string inheritanceModifier = rel.InheritanceModifier == InheritanceModifier.Sealed ? "override sealed" : "override";

        
        #line default
        #line hidden
        
        #line 150 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#region ");

        
        #line default
        #line hidden
        
        #line 151 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(baseRole.Name));

        
        #line default
        #line hidden
        
        #line 151 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" domain role override\r\n\r\n/// <summary>\r\n/// Gets the element playing ");

        
        #line default
        #line hidden
        
        #line 154 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 154 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" domain role.\r\n");

        
        #line default
        #line hidden
        
        #line 155 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

		this.Write(Utilities.Instance.GenerateComments(baseRole.Description));

        
        #line default
        #line hidden
        
        #line 157 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// </summary>\r\n");

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetAccessModifier(baseRole.RolePlayer.AccessModifier)));

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(inheritanceModifier));

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(baseRoleType));

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(baseRole.Name));

        
        #line default
        #line hidden
        
        #line 159 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n{\r\n\t[global::System.Diagnostics.DebuggerStepThrough]\r\n\tget\r\n\t{\r\n\t\treturn this.");

        
        #line default
        #line hidden
        
        #line 164 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 164 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(";\r\n\t}\r\n\t[global::System.Diagnostics.DebuggerStepThrough]\r\n\tset\r\n\t{\r\n\t\tthis.");

        
        #line default
        #line hidden
        
        #line 169 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 169 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" = ");

        
        #line default
        #line hidden
        
        #line 169 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(typeCast));

        
        #line default
        #line hidden
        
        #line 169 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("value;\r\n\t}\r\n}\r\n\r\n#endregion\r\n");

        
        #line default
        #line hidden
        
        #line 174 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
}
// Generate a strongly-typed static accessor placed on a REL for getting REL instances from a MEL
private void GenerateRoleLinkAccessorInternal(DomainRole role)
{
	bool requiresNew = false;
	string rolePlayerType = role.RolePlayer.GetFullName(true);
	
	// Figure out if the method requires a 'new' keyword (if it's already declared in a base relationship).
	for (DomainRelationship baseRel = role.Relationship.BaseRelationship as DomainRelationship; baseRel != null; baseRel = baseRel.BaseRelationship as DomainRelationship)
	{
		foreach (DomainRole baseRole in baseRel.Roles)
		{
			if (baseRole.PropertyName == role.PropertyName && baseRole.RolePlayer.GetFullName(true) == rolePlayerType)
			{
				requiresNew = true;
				break;
			}
		}
	}

        
        #line default
        #line hidden
        
        #line 500 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#region ");

        
        #line default
        #line hidden
        
        #line 501 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 501 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" link accessor\r\n");

        
        #line default
        #line hidden
        
        #line 502 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	if(role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.One || role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.ZeroOne)
	{

        
        #line default
        #line hidden
        
        #line 505 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// <summary>\r\n/// Get the ");

        
        #line default
        #line hidden
        
        #line 507 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.Name));

        
        #line default
        #line hidden
        
        #line 507 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" link to a ");

        
        #line default
        #line hidden
        
        #line 507 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.RolePlayer.Name));

        
        #line default
        #line hidden
        
        #line 507 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n/// </summary>\r\n[global::System.Diagnostics.DebuggerStepThrough]\r\n[global::Sys" +
        "tem.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]\r\n");

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetGeneratedPropertyGetterAccessModifier(role)));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" static ");

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(requiresNew ? "new " : ""));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" GetLinkTo");

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName.TrimStart('@')));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" (");

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(rolePlayerType));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetCamelCase(role.Name)));

        
        #line default
        #line hidden
        
        #line 511 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("Instance)\r\n{\r\n\tglobal::System.Collections.Generic.IList<");

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("> links = DslModeling::DomainRoleInfo.GetElementLinks<");

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">(");

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetCamelCase(role.Name)));

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("Instance, ");

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".");

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 513 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId);\r\n\tglobal::System.Diagnostics.Debug.Assert(links.Count <= 1, \"Multi" +
        "plicity of ");

        
        #line default
        #line hidden
        
        #line 514 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 514 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" not obeyed.\");\r\n\tif ( links.Count == 0 )\r\n\t{\r\n\t\treturn null;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tr" +
        "eturn links[0];\r\n\t}\r\n}\r\n");

        
        #line default
        #line hidden
        
        #line 524 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	else // Multiplicity == many
	{

        
        #line default
        #line hidden
        
        #line 528 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// <summary>\r\n/// Get the list of ");

        
        #line default
        #line hidden
        
        #line 530 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.Name));

        
        #line default
        #line hidden
        
        #line 530 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" links to a ");

        
        #line default
        #line hidden
        
        #line 530 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.RolePlayer.Name));

        
        #line default
        #line hidden
        
        #line 530 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n/// </summary>\r\n[global::System.Diagnostics.DebuggerStepThrough]\r\n[global::Sys" +
        "tem.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]\r\n");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetGeneratedPropertyGetterAccessModifier(role)));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" static ");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(requiresNew ? "new " : ""));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("global::System.Collections.ObjectModel.ReadOnlyCollection<");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("> GetLinksTo");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName.TrimStart('@')));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ( ");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(rolePlayerType));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetCamelCase(role.Name)));

        
        #line default
        #line hidden
        
        #line 534 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("Instance )\r\n{\r\n\treturn DslModeling::DomainRoleInfo.GetElementLinks<");

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">(");

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetCamelCase(role.Name)));

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("Instance, ");

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Relationship.GetFullName(true)));

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".");

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 536 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId);\r\n}\r\n");

        
        #line default
        #line hidden
        
        #line 538 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}

        
        #line default
        #line hidden
        
        #line 540 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#endregion\r\n");

        
        #line default
        #line hidden
        
        #line 542 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

}
// Generate static methods on the relationship to access the opposite role players of a given role player.
private void GenerateStaticRoleAccessorOnRelationshipInternal(DomainRole role, DomainRelationship relationship)
{
	DomainRole opposite = role.Opposite;
	// Camel case the role player name to use as the parameter name
	string roleParameterName = "element";
	string oppositeRoleParameterName = "new"+opposite.Name.TrimStart('@');

        
        #line default
        #line hidden
        
        #line 391 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#region Static methods to access ");

        
        #line default
        #line hidden
        
        #line 392 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 392 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" of a ");

        
        #line default
        #line hidden
        
        #line 392 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.RolePlayer.Name));

        
        #line default
        #line hidden
        
        #line 392 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("\r\n");

        
        #line default
        #line hidden
        
        #line 393 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"


	bool getRequiresNew = false;
	bool setRequiresNew = false;
	
	string roleType = role.RolePlayer.GetRelativeName(relationship.Namespace, true);
	string oppositeRoleType = opposite.RolePlayer.GetRelativeName(relationship.Namespace, true);
	
	// Figure out if the get or set requires a 'new' keyword (if it's already declared in a base relationship).
	for (DomainRelationship baseRel = role.Relationship.BaseRelationship as DomainRelationship; baseRel != null; baseRel = baseRel.BaseRelationship as DomainRelationship)
	{
		foreach (DomainRole baseRole in baseRel.Roles)
		{
			if (baseRole.PropertyName == role.PropertyName &&
				// UNDONE: GeMathew - should we be using relationship.Namespace instead in the line below?
				baseRole.RolePlayer.GetRelativeName(baseRel.Namespace, true) == roleType)
			{
				getRequiresNew = true;
				if (baseRole.Opposite.RolePlayer.GetRelativeName(baseRel.Namespace, true) == oppositeRoleType)
				{
					setRequiresNew = true;
				}
			}
		}
	}
	
	if(role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.One || role.Multiplicity == Tum.PDE.LanguageDSL.Multiplicity.ZeroOne)
	{

        
        #line default
        #line hidden
        
        #line 421 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// <summary>\r\n/// Gets ");

        
        #line default
        #line hidden
        
        #line 423 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 423 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n/// </summary>\r\n[global::System.Diagnostics.DebuggerStepThrough]\r\n[global::Sys" +
        "tem.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]\r\n");

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetGeneratedPropertyGetterAccessModifier(role)));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" static ");

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(getRequiresNew ? "new " : ""));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleType));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" Get");

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName.TrimStart('@')));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("(");

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleType));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 427 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(")\r\n{\r\n\treturn DslModeling::DomainRoleInfo.GetLinkedElement(");

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(", ");

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId) as ");

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(opposite.RolePlayer.GetRelativeName(relationship.Namespace, true)));

        
        #line default
        #line hidden
        
        #line 429 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(";\r\n}\r\n\r\n/// <summary>\r\n/// Sets ");

        
        #line default
        #line hidden
        
        #line 433 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 433 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n/// </summary>\r\n[global::System.Diagnostics.DebuggerStepThrough]\r\n[global::Sys" +
        "tem.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]\r\n");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetGeneratedPropertySetterAccessModifier(role)));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" static ");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(setRequiresNew ? "new " : ""));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("void Set");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName.TrimStart('@')));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("(");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleType));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(", ");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleType));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleParameterName));

        
        #line default
        #line hidden
        
        #line 437 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(")\r\n{\r\n\tDslModeling::DomainRoleInfo.SetLinkedElement(");

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(", ");

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId, ");

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleParameterName));

        
        #line default
        #line hidden
        
        #line 439 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(");\r\n}\r\n");

        
        #line default
        #line hidden
        
        #line 441 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}
	else
	{
		// If the multiplicity of the role is *, figure out what type of 
		// collection type to use. If the user specified a custom collection
		// type, use that.
		string linkedElementCollectionType;
		if (role.Relationship.InheritanceModifier == InheritanceModifier.Abstract)
			{
				linkedElementCollectionType = "DslModeling::ReadOnlyLinkedElementCollection";
			}
			else
			{
				linkedElementCollectionType = "DslModeling::LinkedElementCollection";
			}


        
        #line default
        #line hidden
        
        #line 458 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("/// <summary>\r\n/// Gets a list of ");

        
        #line default
        #line hidden
        
        #line 460 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName));

        
        #line default
        #line hidden
        
        #line 460 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(".\r\n/// </summary>\r\n[global::System.Diagnostics.DebuggerStepThrough]\r\n[global::Sys" +
        "tem.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]\r\n");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(CodeGenerationUtilities.GetGeneratedPropertyGetterAccessModifier(role)));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" static ");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(getRequiresNew ? "new " : ""));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(linkedElementCollectionType));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("<");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleType));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("> Get");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.PropertyName.TrimStart('@')));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("(");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleType));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 464 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(")\r\n{\r\n\treturn GetRoleCollection<");

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(linkedElementCollectionType));

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("<");

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleType));

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">, ");

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(oppositeRoleType));

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(">(");

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(roleParameterName));

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(", ");

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(role.Name));

        
        #line default
        #line hidden
        
        #line 466 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("DomainRoleId);\r\n}\r\n");

        
        #line default
        #line hidden
        
        #line 468 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

	}

        
        #line default
        #line hidden
        
        #line 470 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"
this.Write("#endregion\r\n");

        
        #line default
        #line hidden
        
        #line 472 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\DomainRoleGenerator.tt"

}
public string GenerateStaticRoleAccessorOnRelationship(DomainRole role, DomainRelationship relationship) 
{
	this.GenerationEnvironment = null;
	this.GenerateStaticRoleAccessorOnRelationshipInternal(role, relationship);
	return this.GenerationEnvironment.ToString();
}
Example #13
0
        public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
        {
            if (e.ModelElement != null)
            {
                if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null)
                {
                    if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                    {
                        return;
                    }
                }
            }

            if (e.ModelElement == null)
            {
                return;
            }

            if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None)
            {
                return;
            }

            DomainRole domainRole = e.ModelElement as DomainRole;


            if (domainRole != null)
            {
                if (domainRole.IsDeleted || domainRole.IsDeleting)
                {
                    return;
                }

                if (domainRole.Relationship.IsDeleted || domainRole.Relationship.IsDeleting)
                {
                    return;
                }

                if (e.DomainProperty.Id == DomainRole.NameDomainPropertyId)
                {
                    // display name tracking is already handled by NamedDomainElement
                    if (domainRole.IsNameTracking == TrackingEnum.True)
                    {
                        domainRole.IsNameTracking = TrackingEnum.False;
                    }
                    else if (domainRole.IsNameTracking == TrackingEnum.IgnoreOnce)
                    {
                        domainRole.IsNameTracking = TrackingEnum.True;
                    }

                    if (domainRole.Opposite != null)
                    {
                        if (domainRole.Opposite.IsPropertyNameTracking == TrackingEnum.True)
                        {
                            if (domainRole.Opposite.PropertyName != domainRole.Name)
                            {
                                domainRole.Opposite.PropertyName           = domainRole.Name;
                                domainRole.Opposite.IsPropertyNameTracking = TrackingEnum.IgnoreOnce;
                            }
                        }
                    }

                    if (domainRole.Relationship.IsNameTracking == TrackingEnum.True)
                    {
                        string name;
                        if (domainRole.Relationship is EmbeddingRelationship)
                        {
                            name = EmbeddingRelationship.GenerateDomainRelationshipName(domainRole.Relationship);
                        }
                        else
                        {
                            name = ReferenceRelationship.GenerateDomainRelationshipName(domainRole.Relationship);
                        }

                        if (domainRole.Relationship.Name != name)
                        {
                            domainRole.Relationship.Name           = name;
                            domainRole.Relationship.IsNameTracking = TrackingEnum.IgnoreOnce;
                        }
                    }

                    if (domainRole.Relationship is ReferenceRelationship)
                    {
                        ReferenceRelationship r = domainRole.Relationship as ReferenceRelationship;
                        if (domainRole == domainRole.Relationship.Source)
                        {
                            if (r.IsSerializationSourceNameTracking == TrackingEnum.True)
                            {
                                string name = domainRole.Name + "Ref";
                                if (domainRole.Name == domainRole.Opposite.Name)
                                {
                                    name = domainRole.Name + "Source" + "Ref";
                                }

                                if (name != r.SerializationSourceName)
                                {
                                    r.SerializationSourceName           = name;
                                    r.IsSerializationSourceNameTracking = TrackingEnum.IgnoreOnce;
                                }
                            }
                        }
                        else
                        {
                            if (r.IsSerializationTargetNameTracking == TrackingEnum.True)
                            {
                                string name = domainRole.Name + "Ref";
                                if (domainRole.Name == domainRole.Opposite.Name)
                                {
                                    name = domainRole.Name + "Target" + "Ref";
                                }

                                if (name != r.SerializationTargetName)
                                {
                                    r.SerializationTargetName           = name;
                                    r.IsSerializationTargetNameTracking = TrackingEnum.IgnoreOnce;
                                }
                            }
                        }
                    }
                }
                else if (e.DomainProperty.Id == DomainRole.PropertyNameDomainPropertyId)
                {
                    if (domainRole.IsPropertyNameTracking == TrackingEnum.True)
                    {
                        domainRole.IsPropertyNameTracking = TrackingEnum.False;
                    }
                    else if (domainRole.IsPropertyNameTracking == TrackingEnum.IgnoreOnce)
                    {
                        domainRole.IsPropertyNameTracking = TrackingEnum.True;
                    }

                    if (domainRole.IsPropertyDisplayNameTracking == TrackingEnum.True)
                    {
                        if (domainRole.PropertyDisplayName != StringHelper.BreakUpper(domainRole.PropertyName))
                        {
                            domainRole.PropertyDisplayName           = StringHelper.BreakUpper(domainRole.PropertyName);
                            domainRole.IsPropertyDisplayNameTracking = TrackingEnum.IgnoreOnce;
                        }
                    }
                }
                else if (e.DomainProperty.Id == DomainRole.PropertyDisplayNameDomainPropertyId)
                {
                    if (domainRole.IsPropertyDisplayNameTracking == TrackingEnum.True)
                    {
                        domainRole.IsPropertyDisplayNameTracking = TrackingEnum.False;
                    }
                    else if (domainRole.IsPropertyDisplayNameTracking == TrackingEnum.IgnoreOnce)
                    {
                        domainRole.IsPropertyDisplayNameTracking = TrackingEnum.True;
                    }
                }
            }
        }