Alex Rivera | Logout

How to set attributes values using reflection

Asked 2010-01-29T07:18:23.513
9

I have a class decorated with a attribute ...[DataEntity("MESSAGE_STAGING", EnableCaching = true, CacheTimeout = 43200)]

for some requirement,I want to change this value MESSAGE_STAGING at run time to Test_Message_Staging.

What is the best possible way to achieve this?

Can I use reflection, or is there any other way to do this.

Please provide code samples.

Thanks SNA

Edit
Report

1 Answer

5

It's not possible to change attribute property value at run-time with reflection because attributes are meta-data serialized in the assembly and changing them means changing the assembly.

answered 2010-01-29T08:19:22.127

Your Answer