I have following class definition:
public class ElasticObject : Dictionary
{
public int Id { get;set;}
}
var keyValues = new Elast
I made the extra properties just poke data back in to the base dictionary instead. This way you get to expose a property like "Id" but during serialisation/de-serialisation it will just work with the underlying dictionary:
public class ElasticObject : Dictionary
{
public int Id
{
get {
int val;
if (int.TryParse(this["Id"] as string, out val))
{
return val;
}
return -1;
}
set { this["Id"] = value; }
}
}