public static NodeShape GetMainElementShape(GraphicalDependenciesDiagram element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, GraphicalDependenciesDiagramDomainRoleId) as NodeShape;
		}
		public static void SetMainElementShape(GraphicalDependenciesDiagram element, NodeShape newNodeShape)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, GraphicalDependenciesDiagramDomainRoleId, newNodeShape);
		}
		/// <summary>
		/// Constructor
		/// Creates a GraphicalDependenciesDiagramReferencesMainElementShape link in the same Partition as the given GraphicalDependenciesDiagram
		/// </summary>
		/// <param name="source">GraphicalDependenciesDiagram to use as the source of the relationship.</param>
		/// <param name="target">NodeShape to use as the target of the relationship.</param>
		public GraphicalDependenciesDiagramReferencesMainElementShape(GraphicalDependenciesDiagram source, NodeShape target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesMainElementShape.GraphicalDependenciesDiagramDomainRoleId, source), new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesMainElementShape.NodeShapeDomainRoleId, target)}, null)
		{
		}
		public static void SetGraphicalDependenciesDiagram(NodeShape element, GraphicalDependenciesDiagram newGraphicalDependenciesDiagram)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, NodeShapeDomainRoleId, newGraphicalDependenciesDiagram);
		}
		public static DslModeling::LinkedElementCollection<GraphicalDependencyShape> GetTargetDependencyShapes(GraphicalDependenciesDiagram element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<GraphicalDependencyShape>, GraphicalDependencyShape>(element, GraphicalDependenciesDiagramDomainRoleId);
		}
		private static void WriteChildElements(DslModeling::SerializationContext serializationContext, GraphicalDependenciesDiagram element, global::System.Xml.XmlWriter writer)
		{
			// GraphicalDependenciesDiagramReferencesSourceDependencyShapes
			global::System.Collections.ObjectModel.ReadOnlyCollection<GraphicalDependenciesDiagramReferencesSourceDependencyShapes> allGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstances = GraphicalDependenciesDiagramReferencesSourceDependencyShapes.GetLinksToSourceDependencyShapes(element);
			if (!serializationContext.Result.Failed && allGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstances.Count > 0)
			{
				writer.WriteStartElement("sourceDependencyShapes");
				foreach (GraphicalDependenciesDiagramReferencesSourceDependencyShapes eachGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstance in allGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstance, writer);
				}
				writer.WriteEndElement();
			}
	
			// GraphicalDependenciesDiagramReferencesTargetDependencyShapes
			global::System.Collections.ObjectModel.ReadOnlyCollection<GraphicalDependenciesDiagramReferencesTargetDependencyShapes> allGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstances = GraphicalDependenciesDiagramReferencesTargetDependencyShapes.GetLinksToTargetDependencyShapes(element);
			if (!serializationContext.Result.Failed && allGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstances.Count > 0)
			{
				writer.WriteStartElement("targetDependencyShapes");
				foreach (GraphicalDependenciesDiagramReferencesTargetDependencyShapes eachGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstance in allGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstance, writer);
				}
				writer.WriteEndElement();
			}
	
			// GraphicalDependenciesDiagramReferencesMainElementShape
			GraphicalDependenciesDiagramReferencesMainElementShape theGraphicalDependenciesDiagramReferencesMainElementShapeInstance = GraphicalDependenciesDiagramReferencesMainElementShape.GetLinkToMainElementShape(element);
			if (!serializationContext.Result.Failed && theGraphicalDependenciesDiagramReferencesMainElementShapeInstance != null)
			{
				writer.WriteStartElement("mainElementShape");
				DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theGraphicalDependenciesDiagramReferencesMainElementShapeInstance.GetDomainClass().Id);
				global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theGraphicalDependenciesDiagramReferencesMainElementShapeInstance.GetDomainClass().Name + "!");
				relSerializer.Write(serializationContext, theGraphicalDependenciesDiagramReferencesMainElementShapeInstance, writer);
				writer.WriteEndElement();
			}
	
		}
		private static void ReadGraphicalDependenciesDiagramReferencesMainElementShapeInstance(DslModeling::SerializationContext serializationContext, GraphicalDependenciesDiagram element, global::System.Xml.XmlReader reader)
		{
			if (DslModeling::DomainRoleInfo.GetElementLinks<GraphicalDependenciesDiagramReferencesMainElementShape> (element, GraphicalDependenciesDiagramReferencesMainElementShape.GraphicalDependenciesDiagramDomainRoleId).Count > 0)
			{	// Only allow one instance, which already exists, so skip everything
				DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
				return;
			}
	
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newGraphicalDependenciesDiagramReferencesMainElementShapeSerializer = serializationContext.Directory.GetSerializer(GraphicalDependenciesDiagramReferencesMainElementShape.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newGraphicalDependenciesDiagramReferencesMainElementShapeSerializer != null, "Cannot find serializer for GraphicalDependenciesDiagramReferencesMainElementShape!");
				GraphicalDependenciesDiagramReferencesMainElementShape newGraphicalDependenciesDiagramReferencesMainElementShape = newGraphicalDependenciesDiagramReferencesMainElementShapeSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as GraphicalDependenciesDiagramReferencesMainElementShape;
				if (newGraphicalDependenciesDiagramReferencesMainElementShape != null)
				{
					DslModeling::DomainRoleInfo.SetRolePlayer (newGraphicalDependenciesDiagramReferencesMainElementShape, GraphicalDependenciesDiagramReferencesMainElementShape.GraphicalDependenciesDiagramDomainRoleId, element);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newGraphicalDependenciesDiagramReferencesMainElementShape.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newGraphicalDependenciesDiagramReferencesMainElementShape.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newGraphicalDependenciesDiagramReferencesMainElementShape, reader);
					break;	// Only allow one instance.
				}
				else
				{	// Maybe the relationship is serialized in short-form by mistake.
					DslModeling::DomainClassXmlSerializer newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShapeSerializer = serializationContext.Directory.GetSerializer(NodeShape.DomainClassId);
					global::System.Diagnostics.Debug.Assert(newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShapeSerializer != null, "Cannot find serializer for NodeShape!");
					DslModeling::Moniker newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShape = newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShapeSerializer.TryCreateMonikerInstance(serializationContext, reader, element, GraphicalDependenciesDiagramReferencesMainElementShape.DomainClassId, element.Partition);
					if (newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShape != null)
					{
						TestDslDefinitionSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(GraphicalDependenciesDiagramReferencesMainElementShape));
						new GraphicalDependenciesDiagramReferencesMainElementShape(element.Partition, new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesMainElementShape.GraphicalDependenciesDiagramDomainRoleId, element), new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesMainElementShape.NodeShapeDomainRoleId, newNodeShapeMonikerOfGraphicalDependenciesDiagramReferencesMainElementShape));
						DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
						break;	// Only allow one instance.
					}
					else
					{	// Unknown element, skip.
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
		private static void ReadGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstances(DslModeling::SerializationContext serializationContext, GraphicalDependenciesDiagram element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer = serializationContext.Directory.GetSerializer(GraphicalDependenciesDiagramReferencesTargetDependencyShapes.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer != null, "Cannot find serializer for GraphicalDependenciesDiagramReferencesTargetDependencyShapes!");
				GraphicalDependenciesDiagramReferencesTargetDependencyShapes newGraphicalDependenciesDiagramReferencesTargetDependencyShapes = newGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as GraphicalDependenciesDiagramReferencesTargetDependencyShapes;
				if (newGraphicalDependenciesDiagramReferencesTargetDependencyShapes != null)
				{
					DslModeling::DomainRoleInfo.SetRolePlayer (newGraphicalDependenciesDiagramReferencesTargetDependencyShapes, GraphicalDependenciesDiagramReferencesTargetDependencyShapes.GraphicalDependenciesDiagramDomainRoleId, element);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newGraphicalDependenciesDiagramReferencesTargetDependencyShapes.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newGraphicalDependenciesDiagramReferencesTargetDependencyShapes.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newGraphicalDependenciesDiagramReferencesTargetDependencyShapes, reader);
				}
				else
				{	// Maybe the relationship is serialized in short-form by mistake.
					DslModeling::DomainClassXmlSerializer newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer = serializationContext.Directory.GetSerializer(GraphicalDependencyShape.DomainClassId);
					global::System.Diagnostics.Debug.Assert(newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer != null, "Cannot find serializer for GraphicalDependencyShape!");
					DslModeling::Moniker newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapes = newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapesSerializer.TryCreateMonikerInstance(serializationContext, reader, element, GraphicalDependenciesDiagramReferencesTargetDependencyShapes.DomainClassId, element.Partition);
					if (newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapes != null)
					{
						TestDslDefinitionSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(GraphicalDependenciesDiagramReferencesTargetDependencyShapes));
						new GraphicalDependenciesDiagramReferencesTargetDependencyShapes(element.Partition, new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesTargetDependencyShapes.GraphicalDependenciesDiagramDomainRoleId, element), new DslModeling::RoleAssignment(GraphicalDependenciesDiagramReferencesTargetDependencyShapes.GraphicalDependencyShapeDomainRoleId, newGraphicalDependencyShapeMonikerOfGraphicalDependenciesDiagramReferencesTargetDependencyShapes));
						DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
					}
					else
					{	// Unknown element, skip.
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
		/// <summary>
		/// This method deserializes all child model elements.
		/// </summary>
		/// <remarks>
		/// The caller will position the reader at the open tag of the first child XML element to deserialized.
		/// This method will read as many child elements as it can. It returns under three circumstances:
		/// 1) When an unknown child XML element is encountered. In this case, this method will position the reader at the 
		///    open tag of the unknown element. This implies that if the first child XML element is unknown, this method 
		///    should return immediately and do nothing.
		/// 2) When all child XML elemnets are read. In this case, the reader will be positioned at the end tag of the parent element.
		/// 3) EOF.
		/// </remarks>
		/// <param name="serializationContext">Serialization context.</param>
		/// <param name="reader">XmlReader to read serialized data from.</param>
		/// <param name="element">In-memory GraphicalDependenciesDiagram instance that will get the deserialized data.</param>
		private static void ReadChildElements(DslModeling::SerializationContext serializationContext, GraphicalDependenciesDiagram element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				switch (reader.LocalName)
				{
					case "sourceDependencyShapes":	// Relationship "GraphicalDependenciesDiagramReferencesSourceDependencyShapes"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <sourceDependencyShapes>
							ReadGraphicalDependenciesDiagramReferencesSourceDependencyShapesInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </sourceDependencyShapes>
						}
						break;
					case "targetDependencyShapes":	// Relationship "GraphicalDependenciesDiagramReferencesTargetDependencyShapes"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <targetDependencyShapes>
							ReadGraphicalDependenciesDiagramReferencesTargetDependencyShapesInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </targetDependencyShapes>
						}
						break;
					case "mainElementShape":	// Relationship "GraphicalDependenciesDiagramReferencesMainElementShape"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <mainElementShape>
							ReadGraphicalDependenciesDiagramReferencesMainElementShapeInstance(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </mainElementShape>
						}
						break;
					default:
						return;  // Don't know this element.
				}
			}
		}