2016-07-15 60 views
1

我使用Azure應用服務和Azure表存儲來測試Azure-WebSite的Todo-Item-Example。什麼是Azure應用服務的Azure表存儲的正確實體類型

在Azure的下載示例的DataEntity-ClassEntityData繼承,但在所有其他教程從 TableEntity並在更新紙業2015年9月StorageDataDataEntity-Class繼承DataEntity-Class繼承。

請告訴我,什麼是正確的和最新的方式。

底色:

我想設置partitionKey並且在Azure Table中存儲的rowKey

我怎麼能設置partitionKeyrowKeyStorageDataEntityData。只有在TableEntity我可以設置這些鍵,但是我也要實施ITableData-Interface以使用我的TableController中的TodoItem

+0

嗨,你可以提供鏈接到您正在尋找從EntityData或StorageData繼承的示例嗎?我會看看這些以確保他們不提供過時的信息。謝謝。 –

+1

嗨,Sample是在創建移動應用程序服務(c#-Backend)後,來自portal.azure.com的當前BackEnd-Download-Sample。 public class TodoItem:EntityData { \t public string Text {get;組; } public string描述{get;組; } \t public bool Complete {get;組; } } –

回答

2

你會想從TableEntity繼承。請看看我們的表存儲的示例代碼這裏從TableEntity繼承的類的實例:

https://github.com/Azure-Samples/storage-table-dotnet-getting-started/blob/master/TableStorage/Model/CustomerEntity.cs

+0

但是EntityData是QuickStart代碼中提供的基類 - 必須有一個原因。評論說,EntityData是與EntityFramework一起使用的通用實現。如果我們按照您的建議切換代碼,那麼不會破壞EntityFramework? – Jarvis

0

我切換爲使用StorageData而不是EntityData。它實現相同的接口,併爲PartitionKeyRowKey提供訪問器。它可以在Microsoft.Azure.Mobile.Server.Storage包中找到。

相關問題