Пример #1
0
        protected override bool ReadSmeAttribute(XmlAttribute attribute)
        {
            switch (attribute.LocalName)
            {
            case "invocationMode":
                _invocationMode = EnumEx.Parse <InvocationMode>(attribute.Value, true);
                return(true);

            default:
                return(base.ReadSmeAttribute(attribute));
            }
        }
        protected override bool ReadSmeAttribute(XmlAttribute attribute)
        {
            switch (attribute.LocalName)
            {
            case "relationship":
                Relationship = EnumEx.Parse <RelationshipType>(attribute.Value, true);
                return(true);

            case "isCollection":
                _isCollection = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canGet":
                CanGet = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPost":
                CanPost = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPut":
                CanPut = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canDelete":
                CanDelete = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPagePrevious":
                CanPagePrevious = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPageNext":
                CanPageNext = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPageIndex":
                CanPageIndex = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            default:
                return(base.ReadSmeAttribute(attribute));
            }
        }
        protected virtual bool ReadSmeAttribute(XmlAttribute attribute)
        {
            switch (attribute.LocalName)
            {
            case "label":
                Label = attribute.Value;
                return(true);

            case "unsupported":
                Unsupported = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "compliance":
                Compliance = EnumEx.Parse <ComplianceLevel>(attribute.Value, true);
                return(true);

            case "tags":
                Tags = attribute.Value;
                return(true);

            default:
                return(false);
            }
        }
 protected static void WriteSmeAttribute <T>(string name, T value, ICollection <XmlAttribute> attributes)
     where T : struct
 {
     WriteSmeAttribute(name, !Equals(value, default(T)) ? EnumEx.Format(value) : null, attributes);
 }
 protected static void WriteSmeAttribute <T>(string name, T?value, ICollection <XmlAttribute> attributes)
     where T : struct
 {
     WriteSmeAttribute(name, value != null ? EnumEx.Format(value.Value) : null, attributes);
 }
        protected override bool ReadSmeAttribute(XmlAttribute attribute)
        {
            switch (attribute.LocalName)
            {
            case "pluralName":
                PluralName = attribute.Value;
                return(true);

            case "canSearch":
                CanSearch = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "hasUuid":
                HasUuid = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "supportsETag":
                SupportsETag = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "batchingMode":
                BatchingMode = EnumEx.Parse <BatchingMode>(attribute.Value, true);
                return(true);

            case "isSyncSource":
                IsSyncSource = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "isSyncTarget":
                IsSyncTarget = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "syncConflictPriority":
                SyncConflictPriority = XmlConvert.ToInt32(attribute.Value);
                return(true);

            case "syncOrder":
                SyncOrder = XmlConvert.ToInt32(attribute.Value);
                return(true);

            case "canGet":
                CanGet = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPost":
                CanPost = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPut":
                CanPut = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canDelete":
                CanDelete = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPagePrevious":
                CanPagePrevious = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPageNext":
                CanPageNext = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            case "canPageIndex":
                CanPageIndex = XmlConvert.ToBoolean(attribute.Value);
                return(true);

            default:
                return(base.ReadSmeAttribute(attribute));
            }
        }