gpt4 book ai didi

c# - EF Core 空响应超时

转载 作者:太空宇宙 更新时间:2023-11-03 23:14:28 24 4
gpt4 key购买 nike

我的表中有 2 个货币列。它们在我的模型中是:

public decimal MSRP { get; set; }
public decimal Invoice { get; set; }

我发现当我注释掉这些列时一切正常。然后,我查看了它们与其他货币栏的不同之处。我注意到它们是唯一实际具有 NULL 值的货币列。其他货币列允许 NULL,但没有任何 NULL 列。

然后我将它们更改为字符串,一切都正常加载。

这是输出调试错误:

Microsoft.EntityFrameworkCore.Query.Internal.SqlServerQueryCompilationContextFactory:Error: An exception occurred in the database while iterating the results of a query.

如何构建模型以使其读取为小数但仍允许空值?还是不可能?

最佳答案

使用:

public decimal? MSRP { get; set; }
public decimal? Invoice { get; set; }

关于c# - EF Core 空响应超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37740148/

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