Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Commented Unassigned: A class inherited from DisplayNameAttribute is not used [7152]

$
0
0
I have inherited a class from System.ComponentModel.DisplayNameAttribute. When I add the attribute for property, the property's attribute is not used by FV. I see from the source code that it uses hard-coded class name. See FluentValidation.ValidatorOptions private static string GetDisplayName(MemberInfo member). IMO it should accept any class that can be assigned to typeof(System.ComponentModel.DisplayNameAttribute).

For now I have fixed the problem by giving the class name DisplayNameAttribute (which lives in my namespace).
Comments: Instead of attr.type.Name == "DisplayNameAttribute" I would prefer typeof(System.ComponentModel.DisplayNameAttribute).IsAssignableFrom(attr.type)

Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>