Is it possible to get the decorated class' type inside of the custom attribute's class? For example:
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
public class ViewAttribute : ExportAttribute
{
public object TargetRegion { get; set; }
public Type ViewModel { get; set; }
public Type Module { get; set; }
public ViewAttribute()
: base(typeof(UserControl))
{
Module = GetDecoratedClassType(); //I need this method
}
}
In the following example GetDecoratedClassType() would return HomeView
[View]
HomeView MyHomeView { get; set; }