Skip to content

Instantly share code, notes, and snippets.

@sandrinodimattia
Created November 15, 2012 22:21
Show Gist options
  • Save sandrinodimattia/4081803 to your computer and use it in GitHub Desktop.
Save sandrinodimattia/4081803 to your computer and use it in GitHub Desktop.
DictionaryTableEntity
public class DictionaryTableEntity : TableEntity, IDictionary<string, EntityProperty>
{
private IDictionary<string, EntityProperty> _properties;
public DictionaryTableEntity()
{
_properties = new Dictionary<string, EntityProperty>();
}
public override void ReadEntity(IDictionary<string, EntityProperty> properties, OperationContext operationContext)
{
this._properties = properties;
}
public override IDictionary<string, EntityProperty> WriteEntity(OperationContext operationContext)
{
return _properties;
}
public void Add(string key, EntityProperty value)
{
_properties.Add(key, value);
}
public void Add(string key, bool value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, byte[] value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, DateTime? value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, DateTimeOffset? value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, double value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, Guid value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, int value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, long value)
{
_properties.Add(key, new EntityProperty(value));
}
public void Add(string key, string value)
{
_properties.Add(key, new EntityProperty(value));
}
// IDirectory implementation ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment