public void ReflectionAttributeElasticsearchMappings() { var testSkillParentObject = new MappingTypeTestEntity { CreatedSkillParent = DateTime.UtcNow, UpdatedSkillParent = DateTime.UtcNow, DescriptionSkillParent = "A test entity description", Id = 7, NameSkillParent = "cool", }; var propertyInfo = testSkillParentObject.GetType().GetProperties(); foreach (var property in propertyInfo) { if (Attribute.IsDefined(property, typeof(ElasticsearchCoreTypes))) { var obj = property.Name.ToLower(); object[] attrs = property.GetCustomAttributes(typeof(ElasticsearchCoreTypes), true); Console.WriteLine(obj + " : " + (attrs[0] as ElasticsearchCoreTypes).JsonString()); } } }