Esempio n. 1
0
        private static string GetParameterBindingAttribute(IHasStereotypes stereotypeable)
        {
            const string parameterBinding   = "Parameter Binding";
            const string propertyType       = "Type";
            const string propertyCustomType = "Custom Type";
            const string customValue        = "Custom";

            if (!stereotypeable.HasStereotype(parameterBinding))
            {
                return(string.Empty);
            }

            var attributeName = stereotypeable.GetStereotypeProperty <string>(parameterBinding, propertyType);

            if (!string.Equals(attributeName, customValue, StringComparison.OrdinalIgnoreCase))
            {
                return($"[{attributeName}]");
            }

            var customAttributeValue = stereotypeable.GetStereotypeProperty <string>(parameterBinding, propertyCustomType);

            if (string.IsNullOrWhiteSpace(customAttributeValue))
            {
                throw new Exception("Parameter Binding was set to custom but no Custom attribute type was specified");
            }

            return($"[{customAttributeValue}]");
        }
Esempio n. 2
0
        internal static IEnumerable <string> GetXmlDocLines(this IHasStereotypes hasStereotypes)
        {
            var text = hasStereotypes.GetStereotypeProperty <string>("XmlDoc", "Content");

            return(string.IsNullOrWhiteSpace(text)
                ? new string[0]
                : text
                   .Replace("\r\n", "\r")
                   .Replace("\n", "\r")
                   .Split('\r'));
        }
Esempio n. 3
0
 public static T GetPropertyValue <T>(this IHasStereotypes model, string stereotypeName, string propertyName, T defaultIfNotFound = default(T))
 {
     return(model.GetStereotypeProperty(stereotypeName, propertyName, defaultIfNotFound));
 }