dtretyakov/WindowsAzure

Request to add support for decimal data types

Closed this issue · 5 comments

Can you please add support for entities to have decimal data types?

My entity looks like this:
public sealed class Product
{
[PartitionKey]
public string EntityType
{
get
{
return "product";
}
}
[RowKey]
public string Sku { get; set; }
public string Name { get; set; }
public double Price { get; set; }
}

I receive this error when I call the .AddOrUpdate method on a collection of such entities:
Invalid entity member type: 'System.Decimal'.

Here is the stack trace:
at WindowsAzure.Table.EntityConverters.TypeData.ValueAccessors.ValueAccessorBase1.CreateValueAccessors(ParameterExpression instanceExpression, MemberExpression memberExpression) at WindowsAzure.Table.EntityConverters.TypeData.ValueAccessors.PropertyValueAccessor1..ctor(PropertyInfo propertyInfo)
at WindowsAzure.Table.EntityConverters.TypeData.ValueAccessors.ValueAccessorFactory.Create[T](MemberInfo memberInfo)
at WindowsAzure.Table.EntityConverters.TypeData.Properties.RegularProperty1..ctor(MemberInfo member, String name) at WindowsAzure.Table.EntityConverters.TypeData.Properties.RegularProperty1..ctor(MemberInfo member)
at WindowsAzure.Table.EntityConverters.TypeData.EntityTypeData1.GetMemberProperty(MemberInfo member, IDictionary2 nameChanges)
at WindowsAzure.Table.EntityConverters.TypeData.EntityTypeData1.<.ctor>b__1(MemberInfo member) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at WindowsAzure.Table.EntityConverters.TypeData.EntityTypeData1..ctor()
at WindowsAzure.Table.EntityConverters.TypeData.EntityTypeDataFactory.b__0[T](Type type)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at WindowsAzure.Table.EntityConverters.TypeData.EntityTypeDataFactory.GetEntityTypeDataT
at WindowsAzure.Table.EntityConverters.TableEntityConverter1..ctor() at WindowsAzure.Table.TableSet1..ctor(CloudTableClient cloudTableClient, String tableName)
at WindowsAzure.Table.TableSet`1..ctor(CloudTableClient cloudTableClient)

Hi,

For now Azure Table Storage does not support 'decimal'. But I'll check if we could serialize and deserializa it to string or something like to store on Azure.

Thanks,
Gabriel Marquez

@gblmarquez any updates on this topic?

@forgotten-warrior, please feel free to send a pull request which brings this functionality.

@dtretyakov This PR brings the functionality #65.

@abbasl @forgotten-warrior #65 is merged to master you can start using it. 4