protected override VerifyResult VerifyOneImpl(VerifiableMemberContext context) { if (context is null) { return(_options.ReturnNullReferenceOrSuccess()); } // 如果 Value 为 String,对其进行验证 if (context.Value is string str) { var attr = context.GetAttributes <LengthShould16Attribute>().FirstOrDefault(); if (attr is null) { return(VerifyResult.NullReferenceWith("There's no LengthShould16Attribute on this Member.")); } if (str.Length == 16) { return(VerifyResult.Success); } return(new VerifyResult(new VerifyFailure(context.MemberName, "Length should 16.", str))); } // 否则,如果 Value 不是基础类型(即 Value 为引用类型、结构等),对其进一步解析并验证 if (!context.BasicTypeState()) { return(VerifyImpl(context.ConvertToObjectContext())); } // 否则,认为其类型不是所期待的 return(VerifyResult.UnexpectedTypeWith(context.MemberName)); }