【发布时间】:2014-08-16 17:39:59
【问题描述】:
我最近升级了我的 ASP.NET 项目 (MVC5) 以使用存储库 4.1 来定位 Azure SDK 2.3,当我尝试将任何内容保存到表存储时遇到一个奇怪的错误。
错误:
Microsoft.WindowsAzure.Storage.dll 中出现“Microsoft.WindowsAzure.Storage.StorageException”类型的未处理异常
附加信息:指定了原始值;但是,需要非原始类型 '' 的值。
我的模型通过使用TableServiceContext 来添加、更新、删除和保存的存储库进入表存储。
我的模型遵循这种模式:
[System.Data.Services.Common.DataServiceKey(new string[] { "PartitionKey", "RowKey" })]
public class PersistedAlert : Alert, ITableEntity
{
public string PartitionKey
{
get { return this.StudentId; }
set { this.StudentId = value; }
}
public string RowKey
{
get { return this.Id; }
set { this.Id = value; }
}
public DateTime Timestamp { get; set; }
public new int Type { get; set; } //hides Enum type in Alert base class
}
在升级过程中,我需要换掉所有对
的引用System.Data.Services.*
为
Microsoft.Data.Services.*
...除了 OData 库。
内部是否发生了一些变化,使我的模式不再有效?
【问题讨论】:
-
我遇到了同样的错误,预期类型为空,使用 Web API 2 和 OData V4...对于这个错误绝对没有任何帮助。这让我发疯了!
标签: c# asp.net azure azure-table-storage