public static MorphAction Deserialize(XmlElement element, DeserializationContext context) { var serializationId = element.GetAttribute("id"); var typeName = element.Name; var qualifiedTypeName = string.Format("{0}.{1}", typeof(MorphAction).Namespace, typeName); var actionType = MorphActionAssembly.GetType(qualifiedTypeName, throwOnError: false, ignoreCase: true); if (actionType == null) { throw new InvalidOperationException(string.Format("Cannot find type '{0}' in assembly '{1}'.", qualifiedTypeName, MorphActionAssembly)); } var deserializeMethod = GetDeserializeMethod(actionType); var action = (MorphAction)deserializeMethod.Invoke(null, new object[] { element, context }); foreach ( var linkElement in element.ChildNodes.OfType<XmlElement>().Where(e => e.Name == "linkedaction")) { var targetid = linkElement.GetAttribute("target"); var linkType = (ActionLinkType)Enum.Parse(typeof(ActionLinkType), linkElement.GetAttribute("type"), ignoreCase: true); action.LinkedActions.Add(new ActionLink(context.GetLinkableAction(targetid), linkType)); } context.RegisterLinkableAction(serializationId, action); return action; }