/// <summary> /// This method creates an instance of AblaufbausteinShape based on the tag currently pointed by the reader. The reader is guaranteed (by the caller) /// to be pointed at a serialized instance of AblaufbausteinShape. /// </summary> /// <remarks> /// The caller will guarantee that the reader is positioned at open XML tag of the ModelRoot instance being read. This method should /// not move the reader; the reader should remain at the same position when this method returns. /// </remarks> /// <param name="serializationContext">Serialization context.</param> /// <param name="reader">XmlReader to read serialized data from.</param> /// <param name="partition">Partition in which new AblaufbausteinShape instance should be created.</param> /// <returns>Created AblaufbausteinShape instance.</returns> protected override ModelElement CreateInstance(SerializationContext serializationContext, global::System.Xml.XmlReader reader, Partition partition) { string idStr = reader.GetAttribute("Id"); try { global::System.Guid id; if (string.IsNullOrEmpty(idStr)) { // Create a default Id. id = global::System.Guid.NewGuid(); TestDslDefinitionSerializationBehaviorSerializationMessages.MissingId(serializationContext, reader, id); } else { id = new global::System.Guid(idStr); } string elementIdStr = reader.GetAttribute("internalElementId"); if (string.IsNullOrEmpty(elementIdStr)) { return(null); } else { global::System.Guid elementId = new global::System.Guid(elementIdStr); ModelElement element = null; if (elementId != System.Guid.Empty) { element = partition.ElementDirectory.FindElement(elementId); } if (element == null || !(element is IDomainModelOwnable)) { return(null); } return((element as IDomainModelOwnable).GetDomainModelServices().TopMostService.ShapeProvider.CreateShapeForElement(this.GetShapeClassId(), element, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, id) })); } } catch (global::System.ArgumentNullException /* anEx */) { TestDslDefinitionSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr); } catch (global::System.FormatException /* fEx */) { TestDslDefinitionSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr); } catch (global::System.OverflowException /* ofEx */) { TestDslDefinitionSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr); } return(null); }
/// <summary> /// This method deserializes all properties that are serialized as XML attributes. /// </summary> /// <remarks> /// Because this method only handles properties serialized as XML attributes, the passed-in reader shouldn't be moved inside this method. /// The caller will guarantee that the reader is positioned on the open XML tag of the current element being deserialized. /// </remarks> /// <param name="serializationContext">Serialization context.</param> /// <param name="element">In-memory LinkShape instance that will get the deserialized data.</param> /// <param name="reader">XmlReader to read serialized data from.</param> protected override void ReadPropertiesFromAttributes(SerializationContext serializationContext, ModelElement element, System.Xml.XmlReader reader) { LinkShape instanceOfLinkShape = element as LinkShape; global::System.Diagnostics.Debug.Assert(instanceOfLinkShape != null, "Expecting an instance of LinkShape"); // DummyProperty if (!serializationContext.Result.Failed) { string attribDummyProperty = DiagramsDSLSerializationHelper.Instance.ReadAttribute(serializationContext, element, reader, "dummyProperty"); if (attribDummyProperty != null) { global::System.String valueOfDummyProperty; if (SerializationUtilities.TryGetValue <global::System.String>(serializationContext, attribDummyProperty, out valueOfDummyProperty)) { instanceOfLinkShape.DummyProperty = valueOfDummyProperty; } else { // Invalid property value, ignored. TestDslDefinitionSerializationBehaviorSerializationMessages.IgnoredPropertyValue(serializationContext, reader, "dummyProperty", typeof(global::System.String), attribDummyProperty); } } } // RoutingMode if (!serializationContext.Result.Failed) { string attribRoutingMode = DiagramsDSLSerializationHelper.Instance.ReadAttribute(serializationContext, element, reader, "routingMode"); if (attribRoutingMode != null) { RoutingMode valueOfRoutingMode; if (SerializationUtilities.TryGetValue <RoutingMode>(serializationContext, attribRoutingMode, out valueOfRoutingMode)) { instanceOfLinkShape.RoutingMode = valueOfRoutingMode; } else { // Invalid property value, ignored. TestDslDefinitionSerializationBehaviorSerializationMessages.IgnoredPropertyValue(serializationContext, reader, "routingMode", typeof(RoutingMode), attribRoutingMode); } } } //base.ReadPropertiesFromAttributes(serializationContext, element, reader); }