Microsoft.ResourceManagement.Client.RmResourceFactory.ConstructAttributeValue C# (CSharp) Метод

ConstructAttributeValue() защищенный Метод

protected ConstructAttributeValue ( RmAttributeName attributeName, String innerText ) : IComparable
attributeName Microsoft.ResourceManagement.ObjectModel.RmAttributeName
innerText String
Результат IComparable
        protected IComparable ConstructAttributeValue(RmAttributeName attributeName, String innerText)
        {
            if (innerText == null)
                return null;
            RmAttributeInfo info = null;
            if (base.RmAttributeCache.TryGetValue(attributeName, out info) == false) {
                // just in case they forget to load schema... we know that ObjectId must remove the uuid reference
                if (attributeName.Name.Equals(ObjectID)) {
                    return new RmReference(innerText);
                } else {
                    return innerText;
                }
            }

            try {
                switch (info.AttributeType) {
                case RmAttributeType.String:
                    return innerText;
                case RmAttributeType.DateTime:
                    return DateTime.Parse(innerText);
                case RmAttributeType.Integer:
                    return Int32.Parse(innerText);
                case RmAttributeType.Reference:
                    return new RmReference(innerText);
                case RmAttributeType.Binary:
                    return new RmBinary(innerText);
                case RmAttributeType.Boolean:
                    return Boolean.Parse(innerText);
                default:
                    return innerText;
                }
            } catch (FormatException ex) {
                throw new ArgumentException(
                    String.Format(
                        "Failed to parse attribute {0} with value {1} into type {2}.  Please ensure the resource management schema is up to date.",
                        attributeName,
                        innerText,
                        info.AttributeType.ToString()),
                    ex);
            } catch (System.Text.EncoderFallbackException ex) {
                throw new ArgumentException(
                    String.Format(
                        "Failed to convert the string on binary attribute {0} into byte array.",
                        attributeName),
                    ex);
            }
        }