Ejemplo n.º 1
0
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return
         (metadata.ShowForEdit &&
          !metadata.IsComplexType &&
          !templateInfo.Visited(metadata));
 }
Ejemplo n.º 2
0
 private static bool ShouldShow(ModelExplorer modelExplorer, TemplateInfo templateInfo)
 {
     return
         (modelExplorer.Metadata.ShowForDisplay &&
          !modelExplorer.Metadata.IsComplexType &&
          !templateInfo.Visited(modelExplorer));
 }
Ejemplo n.º 3
0
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return(metadata.ShowForDisplay &&
            metadata.ModelType != typeof(EntityState)
            //&& !metadata.IsComplexType
            && !templateInfo.Visited(metadata));
 }
Ejemplo n.º 4
0
        private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
        {
            return
                (metadata.ShowForEdit
#if false
                 && metadata.ModelType != typeof(EntityState)
#endif
                 && !metadata.IsComplexType &&
                 !templateInfo.Visited(metadata));
        }
        /// <summary>
        /// Checks to see if the given <paramref name="modelExplorer"/> should be rendered or not.
        /// </summary>
        /// <param name="modelExplorer">The model explorer.</param>
        /// <param name="templateInfo">The template information.</param>
        protected virtual bool ShouldShow(ModelExplorer modelExplorer, TemplateInfo templateInfo)
        {
            Guard.NotNull(modelExplorer, nameof(modelExplorer));
            Guard.NotNull(templateInfo, nameof(templateInfo));

            return
                (modelExplorer.Metadata.ShowForEdit &&
                 !modelExplorer.Metadata.IsComplexType &&
                 !templateInfo.Visited(modelExplorer));
        }
Ejemplo n.º 6
0
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     if (metadata.ShowForDisplay /*&& metadata.ModelType != typeof(EntityState)*/ && !metadata.IsComplexType)
     {
         return(!templateInfo.Visited(metadata));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 7
0
        static bool ShowForEdit(HtmlHelper html, ModelMetadata propertyMetadata)
        {
            if (html is null)
            {
                throw new ArgumentNullException(nameof(html));
            }
            if (propertyMetadata is null)
            {
                throw new ArgumentNullException(nameof(propertyMetadata));
            }

            TemplateInfo templateInfo = html.ViewData.TemplateInfo;

            if (templateInfo.Visited(propertyMetadata))
            {
                return(false);
            }

#if !ASPNETMVC
            if (templateInfo.MembersNames.Count > 0)
            {
                return(templateInfo.MembersNames.Contains(propertyMetadata.PropertyName));
            }
#endif

            if (!propertyMetadata.ShowForEdit)
            {
                return(false);
            }

            if (propertyMetadata.AdditionalValues.TryGetValue(nameof(ModelMetadata.ShowForEdit), out bool show))
            {
                return(show);
            }

#if ASPNETMVC
            if (propertyMetadata.ModelType == typeof(EntityState))
            {
                return(false);
            }
#endif

            if (propertyMetadata.ModelType == typeof(IFormFile))
            {
                return(true);
            }

            return(!propertyMetadata.IsComplexType);
        }
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return
         metadata.ShowForDisplay
         && metadata.ModelType != typeof(EntityState)
         && !metadata.IsComplexType
         && !templateInfo.Visited(metadata);
 }
 private static bool ShouldShow(ModelExplorer modelExplorer, TemplateInfo templateInfo)
 {
     return
         modelExplorer.Metadata.ShowForDisplay &&
         !modelExplorer.Metadata.IsComplexType &&
         !templateInfo.Visited(modelExplorer);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Determines whether [is property visible] [the specified metadata].
 /// </summary>
 /// <param name="metadata">The metadata.</param>
 /// <param name="template">The template.</param>
 /// <returns><c>true</c> if [is property visible] [the specified metadata]; otherwise, <c>false</c>.</returns>
 public static bool IsPropertyVisible(this ModelMetadata metadata, TemplateInfo template)
 {
     return(!metadata.HideSurroundingHtml && metadata.ShowForEdit && !template.Visited(metadata));
 }
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return
         metadata.ShowForEdit
         // EntityState is unavailable on mono
         //&& metadata.ModelType != typeof(EntityState)
         && !metadata.IsComplexType
         && !templateInfo.Visited(metadata);
 }
Ejemplo n.º 12
0
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return
         metadata.ShowForEdit &&
         !metadata.IsComplexType
         && !templateInfo.Visited(metadata);
 }
 private static bool ShouldShow(ModelMetadata metadata, TemplateInfo templateInfo)
 {
     return
         metadata.ShowForDisplay
     // MONO: System.Data.Entity is unavailable
        // && metadata.ModelType != typeof(EntityState)
         && !metadata.IsComplexType
         && !templateInfo.Visited(metadata);
 }