diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-31 07:17:47 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-31 07:17:47 -0700 |
commit | 11fc039abf3c3902b3c697624111eb52448cb730 (patch) | |
tree | f466c8ff8e3b873972d5730110e6a64a15fc671c /src | |
parent | 85504a02bf8ca2252fbb8946aa074487e28e5342 (diff) | |
download | DotNetOpenAuth-11fc039abf3c3902b3c697624111eb52448cb730.zip DotNetOpenAuth-11fc039abf3c3902b3c697624111eb52448cb730.tar.gz DotNetOpenAuth-11fc039abf3c3902b3c697624111eb52448cb730.tar.bz2 |
Removed runtime dependency on PresentationFramework.dll unless that feature is actually required.
Fixes #119
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs b/src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs index 24113ac..0c350cb 100644 --- a/src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs +++ b/src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs @@ -100,11 +100,27 @@ namespace DotNetOpenAuth.Configuration { source = HttpContext.Current.Server.MapPath(source); } using (Stream xamlFile = File.OpenRead(source)) { - return (T)XamlReader.Load(xamlFile); + return this.CreateInstanceFromXaml(xamlFile); } } else { return defaultValue; } } + + /// <summary> + /// Creates the instance from xaml. + /// </summary> + /// <param name="xaml">The stream of xaml to deserialize.</param> + /// <returns>The deserialized object.</returns> + /// <remarks> + /// This exists as its own method to prevent the CLR's JIT compiler from failing + /// to compile the CreateInstance method just because the PresentationFramework.dll + /// may be missing (which it is on some shared web hosts). This way, if the + /// XamlSource attribute is never used, the PresentationFramework.dll never need + /// be present. + /// </remarks> + private T CreateInstanceFromXaml(Stream xaml) { + return (T)XamlReader.Load(xaml); + } } } |