Azure表存储SaveChanges返回“;未在指定的资源上实现请求的操作&”;

本文关键字:资源 实现 请求 操作 SaveChanges 存储 返回 Azure | 更新日期: 2023-09-27 18:19:46

在以下Azure表对象上调用save:

public class MyEntity : TableServiceEntity
{
    public string Title { get; set; }
    public string Description { get; set; }
    public float Amount { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}

抛出异常并显示消息:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code>NotImplemented</code>
    <message xml:lang="en-US">
        The requested operation is not implemented on the specified resource.
        RequestId:8d4b648f-64c7-4584-8152-9563c6eb0733
        Time:2013-06-25T13:23:22.1722407Z
    </message>
</error>

Azure表存储SaveChanges返回“;未在指定的资源上实现请求的操作&”;

问题是没有为Azure存储表实现浮点存储。将amount类型更改为双精度将解决此问题。

public class MyEntity : TableServiceEntity
{
    public string Title { get; set; }
    public string Description { get; set; }
    public double Amount { get; set; } // <-- Note change here!!!
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}