private static string GetTypeNameForType(Type type) { var typeName = type.Name; var att = PropertyNameResolver.GetElasticPropertyFor(type); if (att != null && !att.Name.IsNullOrEmpty()) { typeName = att.Name; } else { typeName = Inflector.MakePlural(type.Name).ToLower(); } return(typeName); }
public static string GetTypeNameFor <T>() where T : class { var type = typeof(T); var typeName = type.Name; var att = PropertyNameResolver.GetElasticPropertyFor <T>(); if (att != null && !att.Name.IsNullOrEmpty()) { typeName = att.Name; } else { typeName = Inflector.MakePlural(type.Name).ToLower(); } return(typeName); }
private string InferTypeName <T>() where T : class { var type = typeof(T); var typeName = type.Name; var att = PropertyNameResolver.GetElasticPropertyFor <T>(); if (att != null && !att.Name.IsNullOrEmpty()) { typeName = att.Name; } else { if (this.Settings.TypeNameInferrer != null) { typeName = this.Settings.TypeNameInferrer(typeName); } if (this.Settings.TypeNameInferrer == null || string.IsNullOrEmpty(typeName)) { typeName = Inflector.MakePlural(type.Name).ToLower(); } } return(typeName); }