简体   繁体   English

如何在实体框架中映射biginit,以及如何将字符串转换为biginit

[英]How map a biginit inside entity framework, and how to convert a string into biginit

I have a field named assetid inside sql server with type Biginit.so how I can map this field inside entity framework, and convert a string to biginit. 我在SQL Server中有一个名为BigInitial类型的字段,名称为assetid,因此如何在实体框架中映射此字段并将字符串转换为biginit。 The biginit will be received as an XML string value such as:- biginit将作为XML字符串值接收,例如:

<operation> 
<operationstatus>Success</operationstatus> 
<resourcename>serverrr090909</resourcename> 
<assetid>2701</assetid> 
<message>Rack serverrr090909 added successfully</message> 
</operation>

So I am trying to write something such as :- 所以我试图写一些像:-

Var assetid =  message = doc.SelectSingleNode("/operation/message").InnerText;
// so how I can convert the string into biginit 

update 更新

I wrote the following :- 我写了以下内容:

    public void InsertOrUpdateRack(Rack rack,string username,long assetid)
            {       
//code goes here
    IT360ID = assetid,
                        }

but it raised the folloiwng error on IT360ID = assetid ,Cannot implicitly convert type 'long' to 'int?'. 但是它在IT360ID = assetid上引发了以下错误,无法将类型'long'隐式转换为'int?'。 An explicit conversion exists (are you missing a cast?). 存在显式转换(您是否缺少演员表?)。 so how i can assign an int? 所以我怎么可以分配一个整数? field a long value? 场长值?

只需使用一个long Int64 (与Int64相同):

long assetid = long.Parse(doc.SelectSingleNode("/operation/assetid").InnerText);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM