سؤال

I suspect so, as the abstract class TableServiceEntity have the following:

    public virtual string PartitionKey { get; set; }
    public virtual string RowKey { get; set; }

What if I want a RowKey that is a DateTime or a Double?

هل كانت مفيدة؟

المحلول

yes, these are both strings.

If you want the RowKey to be a DateTime or a Double then you must use a string representation.

There are a few common patterns for this. For DateTime, it's common to see the DateTime represented using a string that is conveniently sorted:

  • DateTime.Ticks.ToString("d19")

or

  • (DateTime.MaxValue.Ticks - DateTime.Ticks).ToString("d19")

See this blog post from Steve Marx - http://blog.smarx.com/posts/using-numbers-as-keys-in-windows-azure

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top