c# - 如何摆脱 'property could not be set to a double value, you must set this property to a non-null value of type decimal'

标签 c# entity-framework stored-procedures entity-framework-4

我正在尝试让函数导入正常工作。 EF 调用我的存储过程,但结果有一个我不理解的内部异常:

var result = context.SomeFunctionImport();

我得到:

The 'Cnt' property on 'SomeClass' could not be set to a 'Double' value. You must set this property to a non-null value of type 'Decimal'.

这是 SomeClassCnt 属性:

    [DataMember]
    public Nullable<decimal> Cnt
    {
        get { return _cnt; }
        set
        {
            if (_cnt != value)
            {
                OnComplexPropertyChanging();
                _cnt = value;
                OnPropertyChanged("Cnt");
            }
        }
    }
    private Nullable<decimal> _cnt;

最佳答案

需要这样定义:public decimal Cnt

关于c# - 如何摆脱 'property could not be set to a double value, you must set this property to a non-null value of type decimal',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6851696/

相关文章:

c# - 我如何为 json 属性返回 null 而不是 "data": []

java - spring-data-mongodb 实体实现接口(interface)创建错误的集合

php - MySQL 过程将空结果返回给 PHP

c# - LINQ - 在 "a"和 "e"之间

c# - 使用 C#,如何将鼠标锁定在窗口内以进行游戏

.net - 如何处理 Entity Framework 中缺少主键的问题?

c# - 来自 c# WinApp 的 Mysql 数据库的存储过程

MySQL 存储过程声明问题

C#:减少健全性检查中的线路噪音

c# - 用对象数组修补对象