Ejemplo n.º 1
0
		public static DslModeling::LinkedElementCollection<MessagePart> GetMessageParts(MessageBase element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<MessagePart>, MessagePart>(element, MessageBaseDomainRoleId);
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Constructor
		/// Creates a MessageHasMessageParts link in the same Partition as the given MessageBase
		/// </summary>
		/// <param name="source">MessageBase to use as the source of the relationship.</param>
		/// <param name="target">MessagePart to use as the target of the relationship.</param>
		public MessageHasMessageParts(MessageBase source, MessagePart target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(MessageHasMessageParts.MessageBaseDomainRoleId, source), new DslModeling::RoleAssignment(MessageHasMessageParts.MessagePartDomainRoleId, target)}, null)
		{
		}
Ejemplo n.º 3
0
		public static void SetMessage(MessagePart element, MessageBase newMessageBase)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, MessagePartDomainRoleId, newMessageBase);
		}
Ejemplo n.º 4
0
		public static DslModeling::LinkedElementCollection<Operation> GetResponseFor(MessageBase element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<Operation>, Operation>(element, MessageBaseDomainRoleId);
		}
Ejemplo n.º 5
0
		public static void SetResponse(Operation element, MessageBase newMessageBase)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, OperationDomainRoleId, newMessageBase);
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Constructor
		/// Creates a RequestReferencedByOperation link in the same Partition as the given MessageBase
		/// </summary>
		/// <param name="source">MessageBase to use as the source of the relationship.</param>
		/// <param name="target">Operation to use as the target of the relationship.</param>
		public RequestReferencedByOperation(MessageBase source, Operation target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(RequestReferencedByOperation.MessageBaseDomainRoleId, source), new DslModeling::RoleAssignment(RequestReferencedByOperation.OperationDomainRoleId, target)}, null)
		{
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Constructor
		/// Creates a OperationReferencesResponse link in the same Partition as the given Operation
		/// </summary>
		/// <param name="source">Operation to use as the source of the relationship.</param>
		/// <param name="target">MessageBase to use as the target of the relationship.</param>
		public OperationReferencesResponse(Operation source, MessageBase target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(OperationReferencesResponse.OperationDomainRoleId, source), new DslModeling::RoleAssignment(OperationReferencesResponse.MessageBaseDomainRoleId, target)}, null)
		{
		}
Ejemplo n.º 8
0
		public static ServiceContractModel GetServiceContractModel(MessageBase element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, MessageBaseDomainRoleId) as ServiceContractModel;
		}
Ejemplo n.º 9
0
		public static void SetServiceContractModel(MessageBase element, ServiceContractModel newServiceContractModel)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, MessageBaseDomainRoleId, newServiceContractModel);
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Constructor
		/// Creates a ServiceContractModelHasMessages link in the same Partition as the given ServiceContractModel
		/// </summary>
		/// <param name="source">ServiceContractModel to use as the source of the relationship.</param>
		/// <param name="target">MessageBase to use as the target of the relationship.</param>
		public ServiceContractModelHasMessages(ServiceContractModel source, MessageBase target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(ServiceContractModelHasMessages.ServiceContractModelDomainRoleId, source), new DslModeling::RoleAssignment(ServiceContractModelHasMessages.MessageBaseDomainRoleId, target)}, null)
		{
		}
Ejemplo n.º 11
0
		private static void WriteChildElements(DslModeling::SerializationContext serializationContext, MessageBase element, global::System.Xml.XmlWriter writer)
		{
			// RequestReferencedByOperation
			global::System.Collections.ObjectModel.ReadOnlyCollection<RequestReferencedByOperation> allRequestReferencedByOperationInstances = RequestReferencedByOperation.GetLinksToRequestFor(element);
			if (!serializationContext.Result.Failed && allRequestReferencedByOperationInstances.Count > 0)
			{
				DslModeling::DomainRelationshipXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(RequestReferencedByOperation.DomainClassId) as DslModeling::DomainRelationshipXmlSerializer;
				global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for RequestReferencedByOperation!");
	
				writer.WriteStartElement("requestFor");
				global::System.Type typeofRequestReferencedByOperation = typeof(RequestReferencedByOperation);
				foreach (RequestReferencedByOperation eachRequestReferencedByOperationInstance in allRequestReferencedByOperationInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					if (eachRequestReferencedByOperationInstance.GetType() != typeofRequestReferencedByOperation)
					{	// Derived relationships will be serialized in full-form.
						DslModeling::DomainClassXmlSerializer derivedRelSerializer = serializationContext.Directory.GetSerializer(eachRequestReferencedByOperationInstance.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(derivedRelSerializer != null, "Cannot find serializer for " + eachRequestReferencedByOperationInstance.GetDomainClass().Name + "!");			
						derivedRelSerializer.Write(serializationContext, eachRequestReferencedByOperationInstance, writer);
					}
					else
					{	// No need to serialize the relationship itself, just serialize the role-player directly.
						DslModeling::ModelElement targetElement = eachRequestReferencedByOperationInstance.Operation;
						DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");			
						targetSerializer.WriteMoniker(serializationContext, targetElement, writer, element, relSerializer);
					}
				}
				writer.WriteEndElement();
			}
	
			// MessageHasMessageParts
			global::System.Collections.ObjectModel.ReadOnlyCollection<MessageHasMessageParts> allMessageHasMessagePartsInstances = MessageHasMessageParts.GetLinksToMessageParts(element);
			if (!serializationContext.Result.Failed && allMessageHasMessagePartsInstances.Count > 0)
			{
				writer.WriteStartElement("messageParts");
				global::System.Type typeofMessageHasMessageParts = typeof(MessageHasMessageParts);
				foreach (MessageHasMessageParts eachMessageHasMessagePartsInstance in allMessageHasMessagePartsInstances)
				{
					if (serializationContext.Result.Failed)
						break;
	
					if (eachMessageHasMessagePartsInstance.GetType() != typeofMessageHasMessageParts)
					{	// Derived relationships will be serialized in full-form.
						DslModeling::DomainClassXmlSerializer derivedRelSerializer = serializationContext.Directory.GetSerializer(eachMessageHasMessagePartsInstance.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(derivedRelSerializer != null, "Cannot find serializer for " + eachMessageHasMessagePartsInstance.GetDomainClass().Name + "!");			
						derivedRelSerializer.Write(serializationContext, eachMessageHasMessagePartsInstance, writer);
					}
					else
					{	// No need to serialize the relationship itself, just serialize the role-player directly.
						DslModeling::ModelElement targetElement = eachMessageHasMessagePartsInstance.MessagePart;
						DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");			
						targetSerializer.Write(serializationContext, targetElement, writer);
					}
				}
				writer.WriteEndElement();
			}
	
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Reads all instances of relationship MessageHasMessageParts.
		/// </summary>
		/// <remarks>
		/// The caller will position the reader at the open tag of the first XML element inside the relationship tag, so it can be
		/// either the first instance, or a bogus tag. This method will deserialize all instances and ignore all bogus tags. When the
		/// method returns, the reader will be positioned at the end tag of the relationship (or EOF if somehow that happens).
		/// </remarks>
		/// <param name="serializationContext">Serialization context.</param>
		/// <param name="element">In-memory MessageBase instance that will get the deserialized data.</param>
		/// <param name="reader">XmlReader to read serialized data from.</param>
		private static void ReadMessageHasMessagePartsInstances(DslModeling::SerializationContext serializationContext, MessageBase element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newMessagePartOfMessageHasMessagePartsSerializer = serializationContext.Directory.GetSerializer(MessagePart.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newMessagePartOfMessageHasMessagePartsSerializer != null, "Cannot find serializer for MessagePart!");
				MessagePart newMessagePartOfMessageHasMessageParts = newMessagePartOfMessageHasMessagePartsSerializer.TryCreateInstance(serializationContext, reader, element.Partition) as MessagePart;
				if (newMessagePartOfMessageHasMessageParts != null)
				{
					element.MessageParts.Add(newMessagePartOfMessageHasMessageParts);
					DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newMessagePartOfMessageHasMessageParts.GetDomainClass().Id);	
					global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newMessagePartOfMessageHasMessageParts.GetDomainClass().Name + "!");
					targetSerializer.Read(serializationContext, newMessagePartOfMessageHasMessageParts, reader);
				}
				else
				{
					global::System.Type typeofMessageHasMessageParts = typeof(MessageHasMessageParts);
					DslModeling::DomainRelationshipXmlSerializer newMessageHasMessagePartsSerializer = serializationContext.Directory.GetSerializer(MessageHasMessageParts.DomainClassId) as DslModeling::DomainRelationshipXmlSerializer;
					global::System.Diagnostics.Debug.Assert(newMessageHasMessagePartsSerializer != null, "Cannot find serializer for MessageHasMessageParts!");
					MessageHasMessageParts newMessageHasMessageParts = newMessageHasMessagePartsSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as MessageHasMessageParts;
					if (newMessageHasMessageParts != null)
					{
						if (newMessageHasMessageParts.GetType() == typeofMessageHasMessageParts)
						{	// The relationship should be serialized in short-form.
							ServiceContractDslSerializationBehaviorSerializationMessages.ExpectingShortFormRelationship(serializationContext, reader, typeof(MessageHasMessageParts));
						}
						DslModeling::DomainRoleInfo.SetRolePlayer (newMessageHasMessageParts, MessageHasMessageParts.MessageBaseDomainRoleId, element);
						DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newMessageHasMessageParts.GetDomainClass().Id);	
						global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newMessageHasMessageParts.GetDomainClass().Name + "!");
						targetSerializer.Read(serializationContext, newMessageHasMessageParts, reader);
					}
					else
					{	// Unknown element, skip
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
Ejemplo n.º 13
0
		private static void ReadRequestReferencedByOperationInstances(DslModeling::SerializationContext serializationContext, MessageBase element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				DslModeling::DomainClassXmlSerializer newOperationMonikerOfRequestReferencedByOperationSerializer = serializationContext.Directory.GetSerializer(Operation.DomainClassId);
				global::System.Diagnostics.Debug.Assert(newOperationMonikerOfRequestReferencedByOperationSerializer != null, "Cannot find serializer for Operation!");
				DslModeling::Moniker newOperationMonikerOfRequestReferencedByOperation = newOperationMonikerOfRequestReferencedByOperationSerializer.TryCreateMonikerInstance(serializationContext, reader, element, RequestReferencedByOperation.DomainClassId, element.Partition);
				if (newOperationMonikerOfRequestReferencedByOperation != null)
				{
					new RequestReferencedByOperation(element.Partition, new DslModeling::RoleAssignment(RequestReferencedByOperation.MessageBaseDomainRoleId, element), new DslModeling::RoleAssignment(RequestReferencedByOperation.OperationDomainRoleId, newOperationMonikerOfRequestReferencedByOperation));
					DslModeling::SerializationUtilities.Skip(reader);	// Moniker contains no child XML elements, so just skip.
				}
				else
				{
					global::System.Type typeofRequestReferencedByOperation = typeof(RequestReferencedByOperation);
					DslModeling::DomainRelationshipXmlSerializer newRequestReferencedByOperationSerializer = serializationContext.Directory.GetSerializer(RequestReferencedByOperation.DomainClassId) as DslModeling::DomainRelationshipXmlSerializer;
					global::System.Diagnostics.Debug.Assert(newRequestReferencedByOperationSerializer != null, "Cannot find serializer for RequestReferencedByOperation!");
					RequestReferencedByOperation newRequestReferencedByOperation = newRequestReferencedByOperationSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as RequestReferencedByOperation;
					if (newRequestReferencedByOperation != null)
					{
						if (newRequestReferencedByOperation.GetType() == typeofRequestReferencedByOperation)
						{	// The relationship should be serialized in short-form.
							ServiceContractDslSerializationBehaviorSerializationMessages.ExpectingShortFormRelationship(serializationContext, reader, typeof(RequestReferencedByOperation));
						}
						DslModeling::DomainRoleInfo.SetRolePlayer (newRequestReferencedByOperation, RequestReferencedByOperation.MessageBaseDomainRoleId, element);
						DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newRequestReferencedByOperation.GetDomainClass().Id);	
						global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newRequestReferencedByOperation.GetDomainClass().Name + "!");
						targetSerializer.Read(serializationContext, newRequestReferencedByOperation, reader);
					}
					else
					{	// Unknown element, skip
						DslModeling::SerializationUtilities.Skip(reader);
					}
				}
			}
		}
Ejemplo n.º 14
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 MessageBase instance that will get the deserialized data.</param>
		private static void ReadChildElements(DslModeling::SerializationContext serializationContext, MessageBase element, global::System.Xml.XmlReader reader)
		{
			while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
			{
				switch (reader.LocalName)
				{
					case "requestFor":	// Relationship "RequestReferencedByOperation"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <requestFor>
							ReadRequestReferencedByOperationInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </requestFor>
						}
						break;
					case "messageParts":	// Relationship "MessageHasMessageParts"
						if (reader.IsEmptyElement)
						{	// No instance of this relationship, just skip
							DslModeling::SerializationUtilities.Skip(reader);
						}
						else
						{
							DslModeling::SerializationUtilities.SkipToFirstChild(reader);  // Skip the open tag of <messageParts>
							ReadMessageHasMessagePartsInstances(serializationContext, element, reader);
							DslModeling::SerializationUtilities.Skip(reader);  // Skip the close tag of </messageParts>
						}
						break;
					default:
						return;  // Don't know this element.
				}
			}
		}