コード例 #1
0
        public AttributeDefinition(IMetaModel metaModel, XmlElement element)
        {
            this.metaModel = metaModel;

            token = element.GetAttribute("token");

            TextBuilder.SplitPrefix(token, '.', out assetTypeToken, out name);

            displayName   = element.GetAttribute("displayname");
            attributeType = (AttributeType)Enum.Parse(typeof(AttributeType), element.GetAttribute("attributetype"));

            isReadonly   = bool.Parse(element.GetAttribute("isreadonly"));
            isRequired   = bool.Parse(element.GetAttribute("isrequired"));
            isMultivalue = bool.Parse(element.GetAttribute("ismultivalue"));

            var baseelement = element.SelectSingleNode("Base") as XmlElement;

            if (baseelement != null)
            {
                baseToken = baseelement.GetAttribute("tokenref");
            }

            var relatedelement = element.SelectSingleNode("RelatedAsset") as XmlElement;

            if (relatedelement != null)
            {
                relatedAssetToken = relatedelement.GetAttribute("nameref");
            }

            ((AssetType)AssetType).SaveAttributeDefinition(this);
        }
コード例 #2
0
        private IOperation LookupOperation(string token)
        {
            string prefix;
            string suffix;

            TextBuilder.SplitPrefix(token, '.', out prefix, out suffix);

            LookupAssetType(prefix);

            IOperation mapped = _map[token] as IOperation;

            if (mapped != null)
            {
                return(mapped);
            }

            return(HookupOperation(prefix, suffix));
        }