TimeSpan property in Azure table storage

I have an object with a property TimeSpanthat I want to save in Azure Table Storage. When I try to save an object, I get an error message:

Cannot include unsupported type "TimeSpan"

Is there a way to do automatic conversion or some other support method TimeSpan?

+5
source share
5 answers

TimeSpan int bigint . . , , , . Entity Framework, unmapped , TimeSpan , .

Azure Tables. , Azure Table Storage, , EF, ATS.

+3

Microsoft, Azure Lucifure Stash .

Lucifure Stash, > 64K, , , , , , . http://www.lucifure.com NuGet.com(http://nuget.org/packages/LucifureStash).

TimeSpan , Azure.

0

JamieSee, TimeSpan int, , , .

, / , , , . , KeyValuePairs.

getter setter.

0

TimeSpan CloudTable, long, TimeSpan:

public class MyEntity : Microsoft.WindowsAzure.Storage.Table.TableEntity
{
    public TimeSpan MyDuration { get; set; }

    // Workaround the fact that TableEntity does not automatically store a `TimeSpan` 
    public long MyDurationTicks
    {
        get { return MyDuration.Ticks; }
        set { MyDuration = TimeSpan.FromTicks(value); }
    }
}
0

TimeSpan TimeSpan? Azure Storage SDK > v8.0.0.

, TableEntity.Flatten :

https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.tableentity.flatten.aspx

, TableEntity.Convertback.

https://msdn.microsoft.com/en-us/library/azure/mt775432.aspx

, IEnumerable/ICollection.

TableEntityAdapter, TableEntity.Flatten ConvertBack .

, , . https://www.nuget.org/packages/TableEntityAdapter/

, Flatten ConvertBack , , . https://www.nuget.org/packages/ObjectFlattenerRecomposer/

0

All Articles