开发者

Partition Key Question

Let's I define my entity like this:

public class User : TableServiceEntity
{
    /// <summary>Unique Id (Row Key)</summary>
    public string Id
    {
        get { return RowKey; }
      开发者_JAVA技巧  set { RowKey = value; }
    }

    /// <summary>Gets or sets the username (Partition Key)</summary>
    public string Username
    {
        get { return PartitionKey; }
        set { PartitionKey = value; }
    } 
}

will the following Linq query use the partition key or not?

var ctx = ServiceLocator.Get<UserDataServiceContext>();
return ctx.Users.Where(x => x.Username == Username).FirstOrDefault();


Pretty sure it will not. You can verify this with Fiddler however. If you do not see a $filter on the wire with PartitionKey and RowKey in it, then you are not querying by them (which is probably bad). I believe what you will have on the wire is an entity that has 4 properties (PK, RK, Id, and Username) and the properties that you will be querying on will not be indexed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜