Esempio n. 1
0
 /// <summary>Gets whether the item definition is required.</summary>
 /// <returns><c>True</c> if item definition is required, otherwise <c>False</c>.</returns>
 public bool GetIsRequired()
 {
     if (ItemMetadata != null)
     {
         return(ItemMetadata.FindMetadataItem <RequiredForCompletenessMetadataItem> () != null);
     }
     return(false);
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the name of the template.
        /// </summary>
        /// <param name="propertyInfo">The property information.</param>
        /// <returns>Returns the name of the template if found in ItemMetatdata otherwise the default based on propertyInfo.</returns>
        public string GetTemplateName(PropertyInfo propertyInfo)
        {
            string templateName = propertyInfo.PropertyType.Name;

            if (ItemMetadata != null)
            {
                var templateNameMetaData = ItemMetadata.FindMetadataItem <TemplateNameMetadataItem> ();
                if (templateNameMetaData != null)
                {
                    templateName = templateNameMetaData.TemplateName;
                }
                else if (propertyInfo.PropertyType.IsSubclassOf(typeof(Lookup)))
                {
                    templateName = "LookupDto";
                }
            }
            else if (propertyInfo.PropertyType.IsSubclassOf(typeof(Lookup)))
            {
                templateName = "LookupDto";
            }
            return(templateName);
        }