0
为了将xml文件保存到Oracle数据库,我经历了许多步骤。C#XmlSerialiser与Oracle Clob优化
XmlCustomType xmlCustomType = new XmlCustomType();
// feed xmlCustomType
var xmlSerializer = new XmlSerializer(typeof(XmlCustomType));
string xml;
using (StringWriter textWriter = new StringWriter())
{
xmlSerializer.Serialize(textWriter, xmlCustomType);
xml = textWriter.ToString();
using (var sr = new StringReader(xml))
{
char[] buffer = new char[1000];
int numChars;
using (OracleConnection con = new OracleConnection(""))
{
OracleClob clob = new OracleClob(con);
while ((numChars = sr.ReadBlock(buffer, 0, buffer.Length)) > 0)
{
clob.Write(buffer, 0, numChars);
}
}
}
}
我想喜欢
XmlCustomType xmlCustomType = new XmlCustomType();
// feed xmlCustomType
var xmlSerializer = new XmlSerializer(typeof(XmlCustomType));
using (OracleConnection con = new OracleConnection(""))
{
OracleClob clob = new OracleClob(con);
xmlSerializer.Serialize(clob, xmlCustomType);
}
东西来优化这个不幸的是,我感到我不能已了解此错误消息:
操作上的Unicode字节数组需要一些参数有偶数值
什么是从xmlserializer到OracleClob的最小步骤?