LINQ到存储过程的“错误的存储属性”错误
问题描述:
我刚刚添加了一个新创建的SP到我的项目,不幸的是需要一个临时表来操作,所以我不得不手动为SP构建我的RESULT类。现在,当我尝试运行时,在下面的属性中出现“Bad Storage Property”错误。LINQ到存储过程的“错误的存储属性”错误
public partial class sp_One_EVA_Get_User_InformationResult
{
private string _Security_USER_ID;
public sp_One_EVA_Get_User_InformationResult()
{
}
[Column(Storage = "_Security_USER_ID;", DbType="VarChar(15) NOT NULL")]
public string Security_USER_ID
{
get
{
return this._Security_USER_ID;
}
set
{
if ((this._Security_USER_ID != value))
{
this._Security_USER_ID = value;
}
}
}
不知道这是什么问题,我已经做了这么多次与其他SP没有任何错误。
答
此线
[Column(Storage = "_Security_USER_ID", DbType="VarChar(15) NOT NULL")]
你有错误写寄存,蒙山分号
答
这可能是此行是错误的:
[Column(Storage = "_Security_USER_ID;", DbType="VarChar(15) NOT NULL")]
我会仔细核对实际上正在从数据库返回什么属性(VarChar(15) NOT NULL
)的DbType
。最有可能的是两者之间不匹配。