Example #1
0
		/// <summary>
		/// Constructor
		/// Creates a EntityShapeReferencesRelationshipshape link in the same Partition as the given EntityShape
		/// </summary>
		/// <param name="source">EntityShape to use as the source of the relationship.</param>
		/// <param name="target">Relationshipshape to use as the target of the relationship.</param>
		public EntityShapeReferencesRelationshipshape(EntityShape source, Relationshipshape target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(EntityShapeReferencesRelationshipshape.EntityShapeDomainRoleId, source), new DslModeling::RoleAssignment(EntityShapeReferencesRelationshipshape.RelationshipshapeDomainRoleId, target)}, null)
		{
		}
Example #2
0
		public static DslModeling::LinkedElementCollection<Relationshipshape> GetRelationshipshape(EntityShape element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<Relationshipshape>, Relationshipshape>(element, EntityShapeDomainRoleId);
		}
Example #3
0
		public static DslModeling::LinkedElementCollection<SqlMapperMappingDiagram> GetSqlMapperMappingDiagrams(EntityShape element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<SqlMapperMappingDiagram>, SqlMapperMappingDiagram>(element, EntityShapeDomainRoleId);
		}
Example #4
0
		/// <summary>
		/// Constructor
		/// Creates a SqlMapperMappingDiagramReferencesEntityShapes link in the same Partition as the given SqlMapperMappingDiagram
		/// </summary>
		/// <param name="source">SqlMapperMappingDiagram to use as the source of the relationship.</param>
		/// <param name="target">EntityShape to use as the target of the relationship.</param>
		public SqlMapperMappingDiagramReferencesEntityShapes(SqlMapperMappingDiagram source, EntityShape target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(SqlMapperMappingDiagramReferencesEntityShapes.SqlMapperMappingDiagramDomainRoleId, source), new DslModeling::RoleAssignment(SqlMapperMappingDiagramReferencesEntityShapes.EntityShapeDomainRoleId, target)}, null)
		{
		}
Example #5
0
		private static void WriteChildElements(DslModeling::SerializationContext serializationContext, EntityShape element, global::System.Xml.XmlWriter writer)
		{
			// EntityShapeReferencesRelationshipshape
			global::System.Collections.ObjectModel.ReadOnlyCollection<EntityShapeReferencesRelationshipshape> allEntityShapeReferencesRelationshipshapeInstances = EntityShapeReferencesRelationshipshape.GetLinksToRelationshipshape(element);
			if (!serializationContext.Result.Failed && allEntityShapeReferencesRelationshipshapeInstances.Count > 0)
			{
				writer.WriteStartElement("relationshipshape");
				foreach (EntityShapeReferencesRelationshipshape eachEntityShapeReferencesRelationshipshapeInstance in allEntityShapeReferencesRelationshipshapeInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachEntityShapeReferencesRelationshipshapeInstance.GetDomainClass().Id);
					global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachEntityShapeReferencesRelationshipshapeInstance.GetDomainClass().Name + "!");
					relSerializer.Write(serializationContext, eachEntityShapeReferencesRelationshipshapeInstance, writer);
				}
				writer.WriteEndElement();
			}
	
		}
Example #6
0
		private static void ReadEntityShapeReferencesRelationshipshapeInstances(DslModeling::SerializationContext serializationContext, EntityShape element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newEntityShapeReferencesRelationshipshapeSerializer = serializationContext.Directory.GetSerializer(EntityShapeReferencesRelationshipshape.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newEntityShapeReferencesRelationshipshapeSerializer != null, "Cannot find serializer for EntityShapeReferencesRelationshipshape!");
				EntityShapeReferencesRelationshipshape newEntityShapeReferencesRelationshipshape = newEntityShapeReferencesRelationshipshapeSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as EntityShapeReferencesRelationshipshape;
				if (newEntityShapeReferencesRelationshipshape != null)
				{
					DslModeling::DomainRoleInfo.SetRolePlayer (newEntityShapeReferencesRelationshipshape, EntityShapeReferencesRelationshipshape.EntityShapeDomainRoleId, element);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newEntityShapeReferencesRelationshipshape.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newEntityShapeReferencesRelationshipshape.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newEntityShapeReferencesRelationshipshape, reader);
				}
				else
				{	// Maybe the relationship is serialized in short-form by mistake.
					DslModeling::DomainClassXmlSerializer newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshapeSerializer = serializationContext.Directory.GetSerializer(Relationshipshape.DomainClassId);
					global::System.Diagnostics.Debug.Assert(newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshapeSerializer != null, "Cannot find serializer for Relationshipshape!");
					DslModeling::Moniker newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshape = newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshapeSerializer.TryCreateMonikerInstance(serializationContext, reader, element, EntityShapeReferencesRelationshipshape.DomainClassId, element.Partition);
					if (newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshape != null)
					{
						SqlMapperMappingSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(EntityShapeReferencesRelationshipshape));
						new EntityShapeReferencesRelationshipshape(element.Partition, new DslModeling::RoleAssignment(EntityShapeReferencesRelationshipshape.EntityShapeDomainRoleId, element), new DslModeling::RoleAssignment(EntityShapeReferencesRelationshipshape.RelationshipshapeDomainRoleId, newRelationshipshapeMonikerOfEntityShapeReferencesRelationshipshape));
						DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
					}
					else
					{	// Unknown element, skip.
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
Example #7
0
		/// <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 EntityShape instance that will get the deserialized data.</param>
		private static void ReadChildElements(DslModeling::SerializationContext serializationContext, EntityShape element, global::System.Xml.XmlReader reader)
		{
			if (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				if (string.Compare(reader.LocalName, "relationshipshape", global::System.StringComparison.CurrentCulture) == 0)
				{
					if (reader.IsEmptyElement)
					{	// No instance of this relationship, just skip
						DslModeling::SerializationUtilities.Skip(reader);
					}
					else
					{
						DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <relationshipshape>
						ReadEntityShapeReferencesRelationshipshapeInstances(serializationContext, element, reader);
						DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </relationshipshape>
					}
				}
			}
		}