问题描述
我用流利的nhibernate映射postgresql数组列时遇到问题。 “属性”列我要处理的内容。
类映射文件
using System;
using ECommercial.Entites.concrete;
using FluentNHibernate.Mapping;
namespace ECommercial.Core.DataAccess.NHibernate.Mappings
{
public class ProductMap : ClassMap<Product>
{
public ProductMap()
{
Map(x=>x.Properties).Column("properties"); // THIS IS THE COLUMN I DEAL WITH
}
}
}
实体文件
using System;
using System.Collections.Generic;
using ECommercial.Core.Entities;
namespace ECommercial.Entites.concrete
{
public class Product : IEntity
{
public virtual string[] Properties { get; set; } // THIS IS THE COLUMN I DEAL WITH
}
}
错误消息(当我获得带有ID的记录时发生错误)
发生异常:CLR / NHibernate.ADOException 'NHibernate.ADOException'添加到您的博客NHibernate.dllöğesinde oluştu,fakatkullanıcıkodundaişlenmedi:“无法投放价值 在类型为SerializableType的String []类型的propertie4_15_字段中。 请检查以确保映射正确并且您的 DataProvider支持此数据类型。” İçözeldurumlar bulundu,达哈 fazlaayrıntıiçindeğişkenlerpenceresinden $ exception'abakın。恩 içtekiözeldurum system.invalidCastException:GetBytes()不是 支持propertie4_15_ konum类型 Npgsql.NpgsqlDataReader.GetBytes(Int32 ordinal,Int64 dataOffset, Byte []缓冲区,Int32 bufferOffset,Int32长度)konum NHibernate.Driver.NHybridDataReader.GetBytes(Int32 i,Int64 fieldOffset,Byte []缓冲区,Int32缓冲区偏移量,Int32长度)konum NHibernate.Type.AbstractBinaryType.Get(DbDataReader rs,Int32 index, ISessionImplementor会话)konum NHibernate.Type.SerializableType.Get(DbDataReader rs,Int32索引, ISessionImplementor会话)konum NHibernate.Type.NullableType.NullSafeGet(DbDataReader rs,字符串名称, ISessionImplementor会话)
我不知道这是什么意思。
在此图像上,我将属性数据类型从string []更改为string,并将断点添加到了setter方法。值是唯一的字符串,里面有“ System.String []”值。
我尝试过什么?
- 将字段的数据类型更改为以下内容:字符串,字符串[],
System.String [],System.String,List
,List , List ,List - 在属性映射方法中添加CustomType
()方法。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)