public static string GetMappedEntity2Pluralized(this Type t, IDictionaryDefaultValueProvider <string, string> pluralizationDictionary = null) { var uriTemplate = t.GetAttribute <MappingEntityAttribute>()?.Entity2UriTemplate; if (!string.IsNullOrWhiteSpace(uriTemplate)) { return(uriTemplate); } return((pluralizationDictionary ?? PluralizationDictionary.Instance).GetValueOrDefault(t.GetMappedEntity2())); }
public static TValue GetValueOrDefault <TKey, TValue>(this IDictionaryDefaultValueProvider <TKey, TValue> dictionary, TKey key, Func <TKey, TValue> defaultValueProvider = null) { TValue value; if (defaultValueProvider == null) { defaultValueProvider = dictionary.DefaultValueProvider; } return(dictionary.TryGetValue(key, out value) || defaultValueProvider == null ? value : defaultValueProvider.Invoke(key)); }
public static string GetMappedEntity2(this Type t, IDictionaryDefaultValueProvider <string, string> pluralizationDictionary = null) { return(t.GetAttribute <MappingEntityAttribute>()?.Entity2); }