public int IndexOf(IXmlaPropertyKey key)
        {
            int result = -1;

            if (this.hashStore.ContainsKey(key))
            {
                result = (int)this.hashStore[key];
            }
            return(result);
        }
        public void Remove(IXmlaPropertyKey value)
        {
            int num = this.IndexOf(value);

            if (-1 != num)
            {
                this.RemoveIndex(num);
                return;
            }
            throw new ArgumentException(SR.Property_DoesNotExist, "value");
        }
            int IEqualityComparer.GetHashCode(object obj)
            {
                IXmlaPropertyKey xmlaPropertyKey = (IXmlaPropertyKey)obj;
                string           text            = string.Format(CultureInfo.InvariantCulture, "{0}#{1}", new object[]
                {
                    (xmlaPropertyKey.Name != null) ? xmlaPropertyKey.Name.GetHashCode().ToString(CultureInfo.InvariantCulture) : string.Empty,
                    (xmlaPropertyKey.Namespace != null) ? xmlaPropertyKey.Namespace.GetHashCode().ToString(CultureInfo.InvariantCulture) : string.Empty
                });

                return(text.GetHashCode());
            }
            int IComparer.Compare(object x, object y)
            {
                IXmlaPropertyKey xmlaPropertyKey  = (IXmlaPropertyKey)x;
                IXmlaPropertyKey xmlaPropertyKey2 = (IXmlaPropertyKey)y;
                int num = string.Compare(xmlaPropertyKey.Name, xmlaPropertyKey2.Name, StringComparison.Ordinal);

                if (num == 0)
                {
                    num = string.Compare(xmlaPropertyKey.Name, xmlaPropertyKey2.Name, StringComparison.Ordinal);
                }
                return(num);
            }
Esempio n. 5
0
 private void WriteVersionSafeXmlaProperty(DictionaryEntry propertyEntry)
 {
     if (propertyEntry.Key is IXmlaPropertyKey)
     {
         IXmlaPropertyKey xmlaPropertyKey = (IXmlaPropertyKey)propertyEntry.Key;
         if (this.IsVersionSafeProperty(xmlaPropertyKey.Name))
         {
             this.WriteXmlaProperty(propertyEntry);
             return;
         }
     }
     else if (this.IsVersionSafeProperty((string)propertyEntry.Key))
     {
         this.WriteXmlaProperty(propertyEntry);
     }
 }
 public object this[IXmlaPropertyKey key]
 {
     get
     {
         int num = this.IndexOf(key);
         if (num == -1)
         {
             throw new ArgumentException(SR.Property_DoesNotExist, "key");
         }
         return(this[num]);
     }
     set
     {
         int num = this.IndexOf(key);
         if (num == -1)
         {
             this.Add(this.CreateBasePropertyObject(key, value));
             return;
         }
         ((IXmlaProperty)this.items[num]).Value = value;
     }
 }
Esempio n. 7
0
 internal override void WriteXmlaProperty(DictionaryEntry entry)
 {
     if (entry.Key is IXmlaPropertyKey)
     {
         IXmlaPropertyKey xmlaPropertyKey = (IXmlaPropertyKey)entry.Key;
         if (entry.Value != null && xmlaPropertyKey.Name != null && xmlaPropertyKey.Name.Length > 0)
         {
             string localName = XmlConvert.EncodeLocalName(xmlaPropertyKey.Name);
             if (xmlaPropertyKey.Namespace == null || xmlaPropertyKey.Namespace.Length == 0)
             {
                 this.writer.WriteElementString(localName, FormattersHelpers.ConvertToXml(entry.Value));
                 return;
             }
             this.writer.WriteElementString(localName, xmlaPropertyKey.Namespace, FormattersHelpers.ConvertToXml(entry.Value));
             return;
         }
     }
     else
     {
         this.writer.WriteElementString((string)entry.Key, FormattersHelpers.ConvertToXml(entry.Value));
     }
 }
Esempio n. 8
0
 protected override IXmlaProperty CreateBasePropertyObject(IXmlaPropertyKey key, object propertyValue)
 {
     return(new AdomdRestriction(key.Name, key.Namespace, propertyValue));
 }
 public bool Contains(IXmlaPropertyKey key)
 {
     return(-1 != this.IndexOf(key));
 }
 protected abstract IXmlaProperty CreateBasePropertyObject(IXmlaPropertyKey key, object propertyValue);