2
讓我定義我的實體是這樣的:分區關鍵問題
public class User : TableServiceEntity
{
/// <summary>Unique Id (Row Key)</summary>
public string Id
{
get { return RowKey; }
set { RowKey = value; }
}
/// <summary>Gets or sets the username (Partition Key)</summary>
public string Username
{
get { return PartitionKey; }
set { PartitionKey = value; }
}
}
將以下Linq查詢使用分區鍵或不呢?
var ctx = ServiceLocator.Get<UserDataServiceContext>();
return ctx.Users.Where(x => x.Username == Username).FirstOrDefault();
訪問基類屬性的屬性存在於呈現給驅動程序的Linq表達式樹中。這一切都取決於駕駛員的聰明程度。但我同意機會很渺茫:) – 2011-06-07 13:48:01