diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-14 15:29:58 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-14 15:29:58 -0700 |
commit | 531ca48170b8e7ecf141b8c46ee3532cba028008 (patch) | |
tree | a11ec514552f2db893fa3d11f5e6a1d10896f83f | |
parent | 37d699e59e096802abbf9a2e976c8bc2f6ad8404 (diff) | |
download | DotNetOpenAuth-531ca48170b8e7ecf141b8c46ee3532cba028008.zip DotNetOpenAuth-531ca48170b8e7ecf141b8c46ee3532cba028008.tar.gz DotNetOpenAuth-531ca48170b8e7ecf141b8c46ee3532cba028008.tar.bz2 |
Added caching to the Channel MessageDescriptionCollection.
Although it can be customized, the default collection is now shared statically for better performance in creating channels.
-rw-r--r-- | src/DotNetOpenAuth/Messaging/Channel.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs index d124668..6c44dc4 100644 --- a/src/DotNetOpenAuth/Messaging/Channel.cs +++ b/src/DotNetOpenAuth/Messaging/Channel.cs @@ -71,9 +71,18 @@ namespace DotNetOpenAuth.Messaging { "; /// <summary> + /// The default cache of message descriptions to use unless they are customized. + /// </summary> + /// <remarks> + /// This is a perf optimization, so that we don't reflect over every message type + /// every time a channel is constructed. + /// </remarks> + private static MessageDescriptionCollection DefaultMessageDescriptions = new MessageDescriptionCollection(); + + /// <summary> /// A cache of reflected message types that may be sent or received on this channel. /// </summary> - private MessageDescriptionCollection messageDescriptions = new MessageDescriptionCollection(); + private MessageDescriptionCollection messageDescriptions = DefaultMessageDescriptions; /// <summary> /// A tool that can figure out what kind of message is being received |