/// <summary> /// /// </summary> /// <param name="serviceProvider"></param> /// <param name="reader"></param> /// <returns></returns> internal static LocationServiceData FromXml(IServiceProvider serviceProvider, XmlReader reader) { LocationServiceData obj = new LocationServiceData(); Debug.Assert(reader.NodeType == XmlNodeType.Element, "Expected a node."); Boolean empty = reader.IsEmptyElement; // Process the xml attributes if (reader.HasAttributes) { while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "AccessPointsDoNotIncludeWebAppRelativeDirectory": obj.m_accessPointsDoNotIncludeWebAppRelativeDirectory = XmlConvert.ToBoolean(reader.Value); break; case "ClientCacheFresh": obj.ClientCacheFresh = XmlConvert.ToBoolean(reader.Value); break; case "DefaultAccessMappingMoniker": obj.DefaultAccessMappingMoniker = reader.Value; break; case "LastChangeId": obj.LastChangeId = XmlConvert.ToInt32(reader.Value); break; case "ClientCacheTimeToLive": obj.ClientCacheTimeToLive = XmlConvert.ToInt32(reader.Value); break; default: // Allow attributes such as xsi:type to fall through break; } } } // Process the fields in Xml elements reader.Read(); if (!empty) { while (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "AccessMappings": obj.AccessMappings = XmlUtility.ArrayOfObjectFromXml <AccessMapping>(serviceProvider, reader, "AccessMapping", false, AccessMapping.FromXml); break; case "ServiceDefinitions": obj.ServiceDefinitions = XmlUtility.ArrayOfObjectFromXml <ServiceDefinition>(serviceProvider, reader, "ServiceDefinition", false, ServiceDefinition.FromXml); break; default: // Make sure that we ignore XML node trees we do not understand reader.ReadOuterXml(); break; } } reader.ReadEndElement(); } return(obj); }
/// <summary> /// /// </summary> /// <param name="serviceProvider"></param> /// <param name="reader"></param> /// <returns></returns> internal static ConnectionData FromXml(IServiceProvider serviceProvider, XmlReader reader) { ConnectionData obj = new ConnectionData(); Debug.Assert(reader.NodeType == XmlNodeType.Element, "Expected a node."); Boolean empty = reader.IsEmptyElement; // Process the xml attributes if (reader.HasAttributes) { while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "CatalogResourceId": obj.m_catalogResourceId = XmlConvert.ToGuid(reader.Value); break; case "InstanceId": obj.InstanceId = XmlConvert.ToGuid(reader.Value); break; case "ServerCapabilities": obj.m_serverCapabilities = XmlConvert.ToInt32(reader.Value); break; case "WebApplicationRelativeDirectory": obj.WebApplicationRelativeDirectory = reader.Value; break; default: // Allow attributes such as xsi:type to fall through break; } } } // Process the fields in Xml elements reader.Read(); if (!empty) { while (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "AuthenticatedUser": obj.AuthenticatedUser = IC.Identity.FromXml(serviceProvider, reader); break; case "AuthorizedUser": obj.AuthorizedUser = IC.Identity.FromXml(serviceProvider, reader); break; case "LocationServiceData": obj.LocationServiceData = LocationServiceData.FromXml(serviceProvider, reader); break; default: // Make sure that we ignore XML node trees we do not understand reader.ReadOuterXml(); break; } } reader.ReadEndElement(); } return(obj); }