I Have some classes in my project, some properties are Browsable(false) so the user couldn't see them:
public class OrderEntity{
public int Id { get; set;}
[Browsable(false)]
public int ProductId { get; set;}
....
}
I want to, if the end-user is Admin, he can see the ProductId, but another user can not see it.
So I need something like this:
public class OrderEntity{
public int Id { get; set;}
[CustomizedBrowsable(false)]
public int ProductId { get; set;}
....
}
public class CustomizedBrowsable: Attribute
{
if(AppContext.UserCode == "Admin") // The current user code saved in a static variable AppContext.UserCode.
//do somethings
else
//do somethings else
}
I defined my own
AdminBrowsableclass usingBrowsableclass code:I only changed the
Constructor: