【发布时间】:2016-11-21 08:53:41
【问题描述】:
我先尝试使用带有 xmltype 列的代码
在我的数据库中:
TIPOS_GRIFOS
ID_TIPOS_GRIFOS:NUMBER(38,0)
DESC_TIPOS_GRIFOS : VARCHAR2(250 BYTE)
配置:XMLTYPE
在我的代码中:
[Table("TIPOS_GRIFOS")]
public class TiposGrifos : BaseEntity
{
[Column("ID_TIPOS_GRIFOS"), Key]
public int IdTiposGrifos { get; set;}
[Column("DESC_TIPOS_GRIFOS")]
public string DescTiposGrifos
{ get; set; }
[Column("CONFIG")]
public string Config
{ get; set; }
[NotMapped]
public XElement xmlData
{
get { return XElement.Parse(Config); }
set { Config = value.ToString(); }
}}
我可以执行:
var tiposGrifo = repository.GetById(1);
tiposGrifo.xmlData = template;
这个对象很好,从数据库中正确导入了数据。但是当我尝试 context.SaveChanges() 时,它会抛出 ORA-932 异常。
谢谢。
PD:我试过了
[Column(TypeName="xml")]
public string Config { get; set; }
那没有用。
更新
我发现了问题:
尝试将长度等于或大于 2,000 个字符的字符串绑定到 XMLType 列或参数时,将遇到“ORA-00932:不一致的数据类型:预期 - 得到 NCLOB”错误。 [错误 12630958]
我尝试插入一个小的 xml(少于 2000 个字符),并且我的代码运行良好。但我需要能够插入更大的 xml……有什么解决办法吗?
【问题讨论】:
标签: c# entity-framework ef-code-first entity-framework-6 xmltype