Why is CompareAttribute in the MVC namespace and not the DataAnnotations namspace?
MVC 3 includes a new validation attribute called CompareAttribute. But why is this validation attribute in the mvc namespace and not with all of the other validation attributes in the DataAnnotations namespace?
Are the other validation attributes spread throughout开发者_StackOverflow other namespaces?
It's just the way things worked out. Derived types do not have to be in the same namespace as the base type. DataAnnotations is part of the .NET framework which releases a lot less frequently than a standalone project like ASP.NET MVC.
It's possible that there are types derived from ValidationAttribute
in other namespaces, but most are part of the core DataAnnotations.
精彩评论