I have a LINQ generated class called Project.
I wanted to add some attributes to the generated properties, so I defined a partial class with the MetadataType attribute.
[MetadataType(typeof(Project_HiddenProps))]
public partial class Project : IProject
{
// There are also a few additional properties defined here.
}
public class Project_HiddenProps
{
[HiddenColumn]
public System.Guid Id { get; set; }
// Id is an auto-generated property that I've added a custom attribute to
}
Later, I use reflection to try to get the attributes of this property.
var customAttributes = prop.GetCustomAttributes(false);
I only get one attribute, though, of type System.Data.Linq.Mapping.ColumnAttribute
. My HiddenColumn
attribute is not included in the collection. My question is how to get at these metadata properties using reflection.
Any help would be greatly appreciated.