[英]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.