예제 #1
0
        internal DestinationSettings(ServiceSettings serviceSettings, XmlNode destinationNode)
        {
            _serviceSettings = serviceSettings;
            _properties      = new Hashtable();
            _channels        = new ChannelSettingsCollection();

            _id = destinationNode.Attributes["id"].Value;

            XmlNode adapterNode = destinationNode.SelectSingleNode("adapter");

            if (adapterNode != null)
            {
                string          adapterRef      = adapterNode.Attributes["ref"].Value;
                AdapterSettings adapterSettings = serviceSettings.AdapterSettings[adapterRef] as AdapterSettings;
                _adapter = adapterSettings;
            }

            _propertiesNode = destinationNode.SelectSingleNode("properties");
            if (_propertiesNode != null)
            {
                XmlNode sourceNode = _propertiesNode.SelectSingleNode("source");
                if (sourceNode != null)
                {
                    _properties["source"] = sourceNode.InnerXml;
                }
                XmlNode factoryNode = _propertiesNode.SelectSingleNode("factory");
                if (factoryNode != null)
                {
                    _properties["factory"] = factoryNode.InnerXml;
                }
                XmlNode attributeIdNode = _propertiesNode.SelectSingleNode("attribute-id");
                if (attributeIdNode != null)
                {
                    //If you specify an attribute-id element in the destination, you can control which attribute the component is stored in
                    //This lets more than one destination share the same instance.
                    _properties["attribute-id"] = attributeIdNode.InnerXml;
                }
                else
                {
                    //Stored using the destination name as the attribute
                    _properties["attribute-id"] = _id;
                }

                XmlNode scopeNode = _propertiesNode.SelectSingleNode("scope");
                if (scopeNode != null)
                {
                    _properties["scope"] = scopeNode.InnerXml;
                }

                XmlNode networkNode = _propertiesNode.SelectSingleNode("network");
                if (networkNode != null)
                {
                    NetworkSettings networkSettings = new NetworkSettings(networkNode);
                    _network = networkSettings;
                }
                XmlNode metadataNode = _propertiesNode.SelectSingleNode("metadata");
                if (metadataNode != null)
                {
                    MetadataSettings metadataSettings = new MetadataSettings(metadataNode);
                    _metadata = metadataSettings;
                }
                XmlNode serverNode = _propertiesNode.SelectSingleNode("server");
                if (serverNode != null)
                {
                    ServerSettings serverSettings = new ServerSettings(serverNode);
                    _server = serverSettings;
                }
                XmlNode msmqNode = _propertiesNode.SelectSingleNode("msmq");
                if (msmqNode != null)
                {
                    MsmqSettings msmqSettings = new MsmqSettings(msmqNode);
                    _msmqSettings = msmqSettings;
                }
            }
            XmlNode channelsNode = destinationNode.SelectSingleNode("channels");

            if (channelsNode != null)
            {
                XmlNodeList channelNodeList = channelsNode.SelectNodes("channel");
                foreach (XmlNode channelNode in channelNodeList)
                {
                    string channelRef = channelNode.Attributes["ref"].Value;
                    if (channelRef != null)
                    {
                        ChannelSettings channelSettings = _serviceSettings.ServiceConfigSettings.ChannelsSettings[channelRef] as ChannelSettings;
                        _channels.Add(channelSettings);
                    }
                    else
                    {
                        ChannelSettings channelSettings = new ChannelSettings(channelNode);
                        _channels.Add(channelSettings);
                    }
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Determines whether the collection contains a specific ChannelSettings value.
 /// </summary>
 /// <param name="value">The ChannelSettings to locate in the collection.</param>
 /// <returns>true if the ChannelSettings is found in the collection; otherwise, false.</returns>
 public bool Contains(ChannelSettings value)
 {
     return(List.Contains(value));
 }
예제 #3
0
 /// <summary>
 /// Removes the first occurrence of a specific ChannelSettings from the collection.
 /// </summary>
 /// <param name="value">The ChannelSettings to remove from the collection.</param>
 public void Remove(ChannelSettings value)
 {
     _channelDictionary.Remove(value.Id);
     List.Remove(value);
 }
예제 #4
0
 /// <summary>
 /// Inserts a ChannelSettings item to the collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted.</param>
 /// <param name="value">The ChannelSettings to insert into the collection.</param>
 public void Insert(int index, ChannelSettings value)
 {
     _channelDictionary[value.Id] = value;
     List.Insert(index, value);
 }
예제 #5
0
 /// <summary>
 /// Determines the index of a specific item in the collection.
 /// </summary>
 /// <param name="value">The ChannelSettings to locate in the collection.</param>
 /// <returns>The index of value if found in the collection; otherwise, -1.</returns>
 public int IndexOf(ChannelSettings value)
 {
     return(List.IndexOf(value));
 }
예제 #6
0
 /// <summary>
 /// Adds a ChannelSettings to the collection.
 /// </summary>
 /// <param name="value">The ChannelSettings to add to the collection.</param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(ChannelSettings value)
 {
     _channelDictionary[value.Id] = value;
     return(List.Add(value));
 }