danikf/tik4net

TikEntityPropertyAccessor.ConvertFromString logic wrong for enum with mutiple flags set

Opened this issue · 0 comments

Filter rule connection-state property contains three flags, but Where() selector uses string.Equals(), so no items will be selected

изображение

.Where(en => string.Equals(PropertyType.GetMember(en)[0].GetCustomAttribute<TikEnumAttribute>(false).Value, strValue, StringComparison.OrdinalIgnoreCase))
#else
else if (PropertyType.GetTypeInfo().IsEnum)
return Enum.GetNames(PropertyType)
.Where(en => string.Equals(PropertyType.GetRuntimeField(en).GetCustomAttribute<TikEnumAttribute>(false).Value, strValue, StringComparison.OrdinalIgnoreCase))