开发者

How can I set the RowKey to a new value with a sequence

I have the following class:

public class Note : TableServiceEntity
{
    public Note( )
    {
    }

    public Note(string pK)
    {
        PartitionKey = pK,
        RowKey = Seq.GetSequence().ToString();
    }
    public string Description { get; set; }
}

What I need is to set the RowKey to the value generated by the sequence. Can anyone explain how to do this with a constructor? What I get is a synt开发者_开发知识库ax error: Virtual member call in constructor.


public static class Seq
{
   static int index;
   public static int GetSequence()
   {
      return index++;
   }
}

public class Note : TableServiceEntity
{
   public Note(string partitionKey, string rowKey) 
      : base(partitionKey, Seq.GetSequence().ToString()) { }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜