Use caching in .NET 3.5 (no dynamic in C# )

216 views
Skip to first unread message

David Martines

unread,
Nov 19, 2012, 2:06:15 PM11/19/12
to agath...@googlegroups.com
Unfortunately, my project must run on .NET 3.5 for the time being.  I have recompiled in 3.5 but had to comment out the line that uses dynamic, in CacheConfiguration, and just not use caching.

//dynamic attribute = Attribute.GetCustomAttribute(requestType, enableResponseCachingAttributeType);

Looking at this again, it seems like the following would work just as well:

var attribute = Attribute.GetCustomAttribute(requestType, enableResponseCachingAttributeType) as IEnableResponseCachingAttribute;

Since enableResponseCachingAttributeType is set in the concrete class (ServiceCacheConfiguration or ClientCacheConfiguration) to the correct attribute type, only the appropriate attributes would be found in each case.

Anyone see any problems with this?

Thanks!

Davy Brion

unread,
Nov 20, 2012, 3:20:09 AM11/20/12
to agath...@googlegroups.com
it looks like it should work, though i haven't tried it

David Martines

unread,
Nov 21, 2012, 11:01:04 AM11/21/12
to agath...@googlegroups.com
Seems to be working fine!
Reply all
Reply to author
Forward
0 new messages