src/Misc/EFTools/EntityDesignModel/AnnotationManager.cs
/// <summary>
///     Update, Create, or Delete an annotation that is represented by an attribute.
///     This also handles defaults.
/// </summary>
/// <param name="namespaceName"></param>
/// <param name="name"></param>
/// <param name="newValue">Pass in null to delete</param>
/// <param name="isDefault"></param>
Update, Create, or Delete an annotation that is represented by an attribute.
This also handles defaults.
Update Create or Delete an annotation that is represented by an attribute . This also handles defaults .
internal void UpdateAttributeValue(string namespaceName, string name, string newValue, bool isDefault)
        {
            Debug.Assert(!String.IsNullOrEmpty(name), "Attribute name for AnnotationManager.UpdateAttributeValue is null or empty");
            if (!String.IsNullOrEmpty(name))
            {
                var xattr = GetAnnotation<XAttribute>(namespaceName, name);
                if (xattr != null)
                {
                    if (newValue == null || isDefault)
                    {
                        xattr.Remove();
                    }
                    else if (xattr.Value != newValue)
                    {
                        xattr.Value = newValue;
                    }
                }
                else if (!isDefault
                         && newValue != null)
                {
                    xattr = new XAttribute(XName.Get(name, namespaceName), newValue);
                    _xElement.Add(xattr);
                }
            }
        }
internal void UpdateAttributeValue ( string namespaceName , string name , string newValue , bool isDefault ) { Debug . Assert ( ! String . IsNullOrEmpty ( name ) , " " ) ; if ( ! String . IsNullOrEmpty ( name ) ) { var xattr = GetAnnotation < XAttribute > ( namespaceName , name ) ; if ( xattr != null ) { if ( newValue == null || isDefault ) { xattr . Remove ( ) ; } else if ( xattr . Value != newValue ) { xattr . Value = newValue ; } } else if ( ! isDefault && newValue != null ) { xattr = new XAttribute ( XName . Get ( name , namespaceName ) , newValue ) ; _xElement . Add ( xattr ) ; } } }
Update, Create, or Delete an annotation that is represented by an attribute.
Update Create or Delete an annotation that is represented by an attribute .
namespaceName
string
None
name
string
None
newValue
string
Pass in null to delete
Pass in null to delete
isDefault
bool
None