Skip to content

Commit

Permalink
Also checking collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Timm Bremus committed Nov 29, 2018
1 parent ab03a52 commit 43f6598
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace BSolutions.Brecons.Core.Attributes.Controls
using BSolutions.Brecons.Core.Exceptions;
using BSolutions.Brecons.Core.Extensions;
using System;
using System.Collections;
using System.Linq;
using System.Reflection;

Expand Down Expand Up @@ -55,8 +56,14 @@ public static void CheckProperties(object tagHelper)
throw new MandatoryAttributeException(htmlAttributeName, tagHelper.GetType());
}

// Enumerable Type
if (typeof(IEnumerable).IsAssignableFrom(propertyInfo.PropertyType) && !((IEnumerable)value).GetEnumerator().MoveNext())
{
throw new MandatoryAttributeException(htmlAttributeName, tagHelper.GetType());
}

// Default Type
if(value == null)
if (value == null)
{
throw new MandatoryAttributeException(htmlAttributeName, tagHelper.GetType());
}
Expand Down

0 comments on commit 43f6598

Please sign in to comment.