TechSmith.Hyde.Table.TableItem.CreateFromStaticType C# (CSharp) Method

CreateFromStaticType() private static method

private static CreateFromStaticType ( object entity, bool throwOnReservedPropertyName ) : TableItem
entity object
throwOnReservedPropertyName bool
return TableItem
        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;
        }