| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Collections.Generic; |
| | 5 | | using System.Reflection; |
| | 6 | |
|
| | 7 | | namespace Azure.Data.Tables.Queryable |
| | 8 | | { |
| | 9 | | internal static class ReflectionUtil |
| | 10 | | { |
| 2 | 11 | | private static MethodInfo DictionaryGetItemMethodInfo { get; } |
| 2 | 12 | | private static MethodInfo DynamicDictionaryGetItemMethodInfo { get; } |
| 2 | 13 | | private static MethodInfo DynamicDictionaryGetBinaryMethodInfo { get; } |
| 2 | 14 | | private static MethodInfo DynamicDictionaryGetBooleanMethodInfo { get; } |
| 2 | 15 | | private static MethodInfo DynamicDictionaryGetDateTimeMethodInfo { get; } |
| 2 | 16 | | private static MethodInfo DynamicDictionaryGetDoubleMethodInfo { get; } |
| 2 | 17 | | private static MethodInfo DynamicDictionaryGetGuidMethodInfo { get; } |
| 2 | 18 | | private static MethodInfo DynamicDictionaryGetInt32MethodInfo { get; } |
| 2 | 19 | | private static MethodInfo DynamicDictionaryGetInt64MethodInfo { get; } |
| 2 | 20 | | private static MethodInfo DynamicDictionaryGetString64MethodInfo { get; } |
| | 21 | |
|
| 2 | 22 | | internal static HashSet<MethodInfo> s_dictionaryMethodInfosHash = new HashSet<MethodInfo>(); |
| | 23 | |
|
| | 24 | | static ReflectionUtil() |
| | 25 | | { |
| 2 | 26 | | DictionaryGetItemMethodInfo = typeof(IDictionary<string, object>).GetMethod("get_Item"); |
| 2 | 27 | | DynamicDictionaryGetItemMethodInfo = typeof(TableEntity).GetMethod("get_Item"); |
| 2 | 28 | | DynamicDictionaryGetBinaryMethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetBinary)); |
| 2 | 29 | | DynamicDictionaryGetBooleanMethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetBoolean)); |
| 2 | 30 | | DynamicDictionaryGetDateTimeMethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetDateTime)); |
| 2 | 31 | | DynamicDictionaryGetDoubleMethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetDouble)); |
| 2 | 32 | | DynamicDictionaryGetGuidMethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetGuid)); |
| 2 | 33 | | DynamicDictionaryGetInt32MethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetInt32)); |
| 2 | 34 | | DynamicDictionaryGetInt64MethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetInt64)); |
| 2 | 35 | | DynamicDictionaryGetString64MethodInfo = typeof(TableEntity).GetMethod(nameof(TableEntity.GetString)); |
| | 36 | |
|
| 2 | 37 | | s_dictionaryMethodInfosHash.Add(DictionaryGetItemMethodInfo); |
| 2 | 38 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetItemMethodInfo); |
| 2 | 39 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetBinaryMethodInfo); |
| 2 | 40 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetBooleanMethodInfo); |
| 2 | 41 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetDateTimeMethodInfo); |
| 2 | 42 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetDoubleMethodInfo); |
| 2 | 43 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetGuidMethodInfo); |
| 2 | 44 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetInt32MethodInfo); |
| 2 | 45 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetInt64MethodInfo); |
| 2 | 46 | | s_dictionaryMethodInfosHash.Add(DynamicDictionaryGetString64MethodInfo); |
| 2 | 47 | | } |
| | 48 | | } |
| | 49 | | } |