# Append properties in NEST

**URL:** <https://discuss.elastic.co/t/append-properties-in-nest/111227>\
**Category:** Elasticsearch\
**Created:** [December 12, 2017, 4:26am UTC](https://discuss.elastic.co/t/append-properties-in-nest/111227 "2017-12-12T04:26:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkdev89](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nkdev89/32/23593_2.png) [@nkdev89](https://discuss.elastic.co/u/nkdev89)\
**Post date:** [December 12, 2017, 4:26am UTC](https://discuss.elastic.co/t/append-properties-in-nest/111227/1 "2017-12-12T04:26:13Z")

</div>

Hi ,

I have the below code , to append the properites to PropertiesDescriptor, But the last property is getting replaced by the new one, Can you please help me with this .

public Func\<MappingsDescriptor, IPromise\> GetMappingsDescriptorr = map =\> map.Map(t =\>  
{  
var properites = typeof(T).GetProperties();  
t.Properties(p =\>  
{  
foreach (var property in properites)  
{  
if (property.MemberType == System.Reflection.MemberTypes.Property)  
{  
var typeOfProperty = property.PropertyType;  
if (typeOfProperty == typeof(string))  
{  
p.Keyword(f =\> [f.Name](http://f.Name)(n =\> [property.Name](http://property.Name)));  
}  
else if (typeOfProperty == typeof(Dslr))  
{  
p.Object(f =\> [f.Name](http://f.Name)(n =\> [property.Name](http://property.Name)));  
}  
else if (typeOfProperty == typeof(DateTime))  
{  
p.Date(f =\> [f.Name](http://f.Name)(n =\> [property.Name](http://property.Name)));  
}  
}  
}  
return p;  
});  
return t;  
});

I trying create mapping dynamically based on the available properites in a class, But when i try to add second properites the first one is getting replaced by the second.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 9, 2018, 4:27am UTC](https://discuss.elastic.co/t/append-properties-in-nest/111227/2 "2018-01-09T04:27:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
