/// <summary>Removes an annotation with the specified name.</summary>
        /// <param name="name">The name of the annotation property.</param>
        /// <returns>true if an annotation was removed; otherwise, false.</returns>
        public bool RemoveAnnotation(string name)
        {
            Check.NotEmpty(name, nameof(name));
            MetadataPropertyCollection metadataProperties = this.GetMetadataProperties();
            MetadataProperty           metadataProperty;

            if (metadataProperties.TryGetValue(name, false, out metadataProperty))
            {
                return(metadataProperties.Remove(metadataProperty));
            }
            return(false);
        }
 internal MetadataPropertyCollection GetMetadataProperties()
 {
     if (this._itemAttributes == null)
     {
         MetadataPropertyCollection propertyCollection = new MetadataPropertyCollection(this);
         if (this.IsReadOnly)
         {
             propertyCollection.SetReadOnly();
         }
         Interlocked.CompareExchange <MetadataPropertyCollection>(ref this._itemAttributes, propertyCollection, (MetadataPropertyCollection)null);
     }
     return(this._itemAttributes);
 }
Exemplo n.º 3
0
 internal MetadataPropertyCollection GetMetadataProperties()
 {
     if (null == _itemAttributes)
     {
         var itemAttributes = new MetadataPropertyCollection(this);
         if (IsReadOnly)
         {
             itemAttributes.SetReadOnly();
         }
         Interlocked.CompareExchange(
             ref _itemAttributes, itemAttributes, null);
     }
     return(_itemAttributes);
 }
Exemplo n.º 4
0
 private static IEnumerable <MetadataProperty> GetSystemMetadataProperties(
     MetadataItem item)
 {
     return(MetadataPropertyCollection.GetItemTypeInformation(item.GetType()).GetItemAttributes(item));
 }
Exemplo n.º 5
0
 internal MetadataPropertyCollection(MetadataItem item)
     : base(MetadataPropertyCollection.GetSystemMetadataProperties(item))
 {
 }