Adding the MetadataTypeAttribute
will only be useful when you have written custom code that detects the BrowsableAttribute
. The .NET framework doesn't handle MetadataTypeAttribute
any differently than any other attribute and doesn't 'merge' your type with the meta data type.
When you have written your own code that detects the BrowsableAttribute
, you can change it, so it also detects a MetadataTypeAttribute
on a type and if it exists, you can go to the referred metadata class to search for properties decorated with the BrowsableAttribute
. When the logic using the BrowsableAttribute
has not been written by you (for instance, this is part of the .NET framework, because it is used by the Visual Studio designer), there is no way of getting this to work.
Currently there are only a few parts of the .NET framework that know about the MetadataTypeAttribute
. MVC for instance uses it for validation and with .NET 4.0 DataAnnotations (that defines the attribute) also has a validator. Enterprise Library 5.0 (currently in beta) will also detect this attribute for validation.
While more and more applications and part of the framework might be able to handle this attribute, in most situations using it is useless.