}                                         // 此菜单关联的权限key.
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (MenuType == MenuEnumType.Menu)
            {
                if (Name.IsNullOrWhiteSpace())
                {
                    yield return(new ValidationResult("Name 不能为空", new[] { "Name" }));
                }

                if (DisplayName.IsNullOrWhiteSpace())
                {
                    yield return(new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" }));
                }

                if (RouterPath.IsNullOrWhiteSpace())
                {
                    yield return(new ValidationResult("RouterPath 不能为空", new[] { "RouterPath" }));
                }

                if (ComponentPath.IsNullOrWhiteSpace())
                {
                    yield return(new ValidationResult("ComponentPath 不能为空", new[] { "ComponentPath" }));
                }
            }
            else if (MenuType == MenuEnumType.Permission)
            {
                if (DisplayName.IsNullOrWhiteSpace())
                {
                    yield return(new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" }));
                }

                if (!ParentId.HasValue)
                {
                    yield return(new ValidationResult("ParentId 不能为空", new[] { "ParentId" }));
                }
            }
        }