/// <summary> /// 附加复选项目列表,文本/值。 /// </summary> /// <param name="items">复选框项目列表实例。</param> protected override void Init(IDictionary <string, object?> items) { Type?type = null; if (For != null && For.Model is IEnumerable array) { type = For.ModelExplorer.ModelType.GetElementType(); Value = array.OfType <Enum>().ToArray(); } else if (IgnoreValue != null) { type = IgnoreValue.GetType(); } else if (IgnoreValues != null) { type = IgnoreValues.First().GetType(); } else if (Value is not null) { type = Value.First().GetType(); } if (type != null) { Init(items, type); } else { throw new Exception(Resources.EnumDropdownListTagHelper_TypeNotFound); } }
/// <summary> /// 附加复选项目列表,文本/值。 /// </summary> /// <param name="items">复选框项目列表实例。</param> protected override void Init(IDictionary <string, object?> items) { if (For != null) { Init(items, For.ModelExplorer.ModelType); Value = For.Model as Enum; } else if (IgnoreValue != null) { Init(items, IgnoreValue.GetType()); } else if (Value is Enum value) { Init(items, value.GetType()); } else { throw new Exception(Resources.EnumDropdownListTagHelper_TypeNotFound); } }