Entity framework 无法将“xyz”上的“abc”属性设置为“Int32”值。必须将此属性设置为“Boolean”类型的非空值
我正在尝试使函数导入正常工作。EF调用我的存储过程,但结果有一个我不理解的内部异常: 无法将“uspLoadTemplateByID_Result”上的“IsPublished”属性设置为“Int32”值。必须将此属性设置为 类型为“Boolean”的非空值 我的designer.c是Entity framework 无法将“xyz”上的“abc”属性设置为“Int32”值。必须将此属性设置为“Boolean”类型的非空值,entity-framework,stored-procedures,model-view-controller,nullable,Entity Framework,Stored Procedures,Model View Controller,Nullable,我正在尝试使函数导入正常工作。EF调用我的存储过程,但结果有一个我不理解的内部异常: 无法将“uspLoadTemplateByID_Result”上的“IsPublished”属性设置为“Int32”值。必须将此属性设置为 类型为“Boolean”的非空值 我的designer.c是 [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] [DataMemberAttribute()]
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public Nullable<global::System.Boolean> IsPublished
{
get
{
return _IsPublished;
}
set
{
OnIsPublishedChanging(value);
ReportPropertyChanging("IsPublished");
_IsPublished = StructuralObject.SetValidValue(value);
ReportPropertyChanged("IsPublished");
OnIsPublishedChanged();
}
}
private Nullable<global::System.Boolean> _IsPublished;
partial void OnIsPublishedChanging(Nullable<global::System.Boolean> value);
partial void OnIsPublishedChanged();
呃。。。这个信息对我来说似乎不言自明。如果实体框架假定存储过程的结果中有一个bit列,因为这是您显式或隐式指定的,但存储过程实际上有一个int列,您希望出现什么行为?是的,您是对的,但在本例中存储过程返回布尔类型值,并且在所有edmx.designer.cs中,我找不到ispublished属性的任何Int32类型。在实体框架的设计器字段中,显示布尔值,但在内部异常中,它会出现可为null的问题。您能显示您的类吗,映射和存储过程?存储过程返回此记录:选择ID、TemplateName、[描述]、代码、[版本]、SaveCount、ModuleType、'Module'作为报告类型、ApplicationID、ISNULLIsPublished、0作为IsPublished