c# - .NET Reflection to set attributes on my runtime objects -
i having asp.net mvc project need read dynamic table , display in grid.
my framework supports binding static types grids, adding attributes static type properties e.g. [grid], [key], [gridcolumn(name="id", order=1, ishidden=true)]
i hence building dynamic object reflection , assigning required metadata allow framework read dynamic object grid.
although have managed assign reflection required attributes have no properties , think know how attributes take constructor parameters, struggling set properties of name, order, ishidden of gridcolumnattribute (which not take parameters in framework)
do know way of doing it?
i found jon in how set attributes values using reflection mentioned not possible why possible constructor parameters , not public properties of attribute?
if think possible, appreciate code example.
many thanks
i don't know how prove not possible... somehow frighten me if reflection change, example, passive security checks.
[principalpermission(security.demand, role="builtin\\administrators"] void someverysecuredstuff() { //... } i'm not trusted source reflection, i hope cannot achieved.
c# .net asp.net-mvc reflection attributes
No comments:
Post a Comment