[英]How map a biginit inside entity framework, and how to convert a string into biginit
我在SQL Server中有一个名为BigInitial类型的字段,名称为assetid,因此如何在实体框架中映射此字段并将字符串转换为biginit。 biginit将作为XML字符串值接收,例如:
<operation>
<operationstatus>Success</operationstatus>
<resourcename>serverrr090909</resourcename>
<assetid>2701</assetid>
<message>Rack serverrr090909 added successfully</message>
</operation>
所以我试图写一些像:-
Var assetid = message = doc.SelectSingleNode("/operation/message").InnerText;
// so how I can convert the string into biginit
更新
我写了以下内容:
public void InsertOrUpdateRack(Rack rack,string username,long assetid)
{
//code goes here
IT360ID = assetid,
}
但是它在IT360ID = assetid
上引发了以下错误,无法将类型'long'隐式转换为'int?'。 存在显式转换(您是否缺少演员表?)。 所以我怎么可以分配一个整数? 场长值?
只需使用一个long
Int64
(与Int64
相同):
long assetid = long.Parse(doc.SelectSingleNode("/operation/assetid").InnerText);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.