Exemplo n.º 1
0
        /// <summary>
        /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>
        /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
        /// Value
        /// Meaning
        /// Less than zero
        /// This instance is less than <paramref name="obj"/>.
        /// Zero
        /// This instance is equal to <paramref name="obj"/>.
        /// Greater than zero
        /// This instance is greater than <paramref name="obj"/>.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">
        ///     <paramref name="obj"/> is not the same type as this instance.
        /// </exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentException("Parameter cannot be null");
            }
            NodeDescriptorWrapper other = obj as NodeDescriptorWrapper;

            if (other == null)
            {
                throw new ArgumentNullException("Parameter is not the same type as this instance.");
            }
            if (this.NodeIdentifier == null || other.NodeIdentifier == null)
            {
                throw new ArgumentNullException("Instance identifier cannot be null.");
            }
            if (this.NodeIdentifier.IsEmpty || other.NodeIdentifier.IsEmpty)
            {
                throw new ArgumentNullException("Instance identifier cannot be empty.");
            }
            if (String.IsNullOrEmpty(this.NodeIdentifier.Namespace) || String.IsNullOrEmpty(other.NodeIdentifier.Namespace))
            {
                throw new ArgumentNullException("Instance identifier Namespace cannot be null.");
            }
            int ret = NodeIdentifier.Namespace.CompareTo(other.NodeIdentifier.Namespace);

            if (ret != 0)
            {
                return(ret);
            }
            if (String.IsNullOrEmpty(this.NodeIdentifier.Name) || String.IsNullOrEmpty(other.NodeIdentifier.Namespace))
            {
                throw new ArgumentNullException("Instance identifier Name cannot be null.");
            }
            return(NodeIdentifier.Name.CompareTo(other.NodeIdentifier.Name));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceConfiguration"/> class.
 /// </summary>
 /// <param name="nodeUniqueIdentifier">The node unique identifier.</param>
 internal InstanceConfiguration(INodeDescriptor nodeUniqueIdentifier)
 {
     NodeDescriptor = new NodeDescriptorWrapper(nodeUniqueIdentifier);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceConfiguration"/> class .
 /// </summary>
 /// <param name="dataSources">The data sources.</param>
 /// <param name="ns">The namespace.</param>
 /// <param name="name">The name of the item.</param>
 public InstanceConfiguration(DataSourceConfiguration[] dataSources, string ns, string name)
 {
     m_DataSources  = dataSources;
     NodeDescriptor = new NodeDescriptorWrapper(ns, name);
 }