I had asked this question
Adding more attributes to LINQ to SQL entity
Now, when I add Browsable attribute to generated entity in designer,it works.But,when I use the MetaDataType approach,and add Browsable attribute in partial class,it does not work
“I added a MetaDataType class, and added browsable attribute to property,but seems to have no effect”
Adding the
MetadataTypeAttributewill only be useful when you have written custom code that detects theBrowsableAttribute. The .NET framework doesn’t handleMetadataTypeAttributeany 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 aMetadataTypeAttributeon a type and if it exists, you can go to the referred metadata class to search for properties decorated with theBrowsableAttribute. When the logic using theBrowsableAttributehas 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.