gpt4 book ai didi

c# - 将值 "AAAAAAAAB9c="转换为类型 'System.Version' 时出错。路径 'version'

转载 作者:行者123 更新时间:2023-12-03 05:07:34 27 4
gpt4 key购买 nike

每当我尝试访问我的 Azure 移动服务表时,都会收到以下错误:

An exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: Error converting value "AAAAAAAAB9k=" to type 'System.Version'. Path 'version', line 19, position 27.

这是发生此错误的行:

await App.MobileService.GetTable<TodoItem>().InsertAsync(todoItem);

我实际上不需要表中的版本值。该值由 Azure 自动生成。有没有办法强制忽略版本值?

这是 TodoItem 定义:

 public class TodoItem
{
public string Id { get; set; }
public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; }
public Version version { get; set; }
public bool deleted { get; set; }

... and so on...
}

最佳答案

您的 TodoItem 代码错误。它应该是这样的:

[Version]
public string Version {get; set;}

此处 [Version] 引用位于 Microsoft.WindowsAzure.MobileServices 命名空间中的 VersionAttrbute。

关于c# - 将值 "AAAAAAAAB9c="转换为类型 'System.Version' 时出错。路径 'version',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37142388/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com