private static TableItem CreateFromStaticType( object entity, bool throwOnReservedPropertyName )
{
var properties = new Dictionary<string, Tuple<object, Type>>();
foreach ( var property in entity.GetType().GetTypeInfo().GetProperties().Where( p => p.ShouldSerialize() ) )
{
properties[property.Name] = new Tuple<object, Type>( property.GetValue( entity, null ), property.PropertyType );
}
var item = new TableItem( properties, throwOnReservedPropertyName );
if ( entity.HasPropertyDecoratedWith<PartitionKeyAttribute>() )
{
item.PartitionKey = entity.ReadPropertyDecoratedWith<PartitionKeyAttribute, string>();
}
if ( entity.HasPropertyDecoratedWith<RowKeyAttribute>() )
{
item.RowKey = entity.ReadPropertyDecoratedWith<RowKeyAttribute, string>();
}
if ( entity.HasPropertyDecoratedWith<ETagAttribute>() )
{
item.ETag = entity.ReadPropertyDecoratedWith<ETagAttribute, object>();
}
return item;
}