diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-10 23:25:21 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-10 23:25:21 -0500 |
| commit | ec63e13bbe3078ee1594a00e30224ffff22c6c64 (patch) | |
| tree | cd04209fc43b24bee5834534365071ef48aab49a /MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs | |
| parent | 8492225deef59b4548976e162f6fa147abf923be (diff) | |
more portable restructuring
Diffstat (limited to 'MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs b/MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs deleted file mode 100644 index 2de02d817..000000000 --- a/MediaBrowser.Server.Implementations/Persistence/TypeMapper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Linq; - -namespace MediaBrowser.Server.Implementations.Persistence -{ - /// <summary> - /// Class TypeMapper - /// </summary> - public class TypeMapper - { - /// <summary> - /// This holds all the types in the running assemblies so that we can de-serialize properly when we don't have strong types - /// </summary> - private readonly ConcurrentDictionary<string, Type> _typeMap = new ConcurrentDictionary<string, Type>(); - - /// <summary> - /// Gets the type. - /// </summary> - /// <param name="typeName">Name of the type.</param> - /// <returns>Type.</returns> - /// <exception cref="System.ArgumentNullException"></exception> - public Type GetType(string typeName) - { - if (string.IsNullOrEmpty(typeName)) - { - throw new ArgumentNullException(); - } - - return _typeMap.GetOrAdd(typeName, LookupType); - } - - /// <summary> - /// Lookups the type. - /// </summary> - /// <param name="typeName">Name of the type.</param> - /// <returns>Type.</returns> - private Type LookupType(string typeName) - { - return AppDomain - .CurrentDomain - .GetAssemblies() - .Select(a => a.GetType(typeName, false)) - .FirstOrDefault(t => t != null); - } - } -} |
