Nhibaernate 在使用Iset<>Invalid Cast错误
来源:互联网 发布:冬天保湿面霜推荐 知乎 编辑:程序博客网 时间:2024/05/22 00:37
Invalid Cast (check your mapping for property type mismatches);
setter of NHibernateSample.Domain.Entities.Customer(查询报错)
使用:public virtual ISet<ShipFisGear> ShipFisGear { get; set; }
ISet查询其实是:
set
集合中的对象是唯一的,无序的,不能通过索引、key值访问,只能使用enumerator列举集合对象。
.Net没有原生的set类,所以NHibernate使用Iesi.Collections的set。
不同的set实现可能存在一些差异,因此导致set表现出来的特性不大一样,但在设计、使用上的主要原则是将set看作唯一、无序的。
Iesi.Collections中,基于System.Collections.SortedList实现的ListSet在列举集合对象时顺序跟添加到set的顺序一致,但基于System.Collections.HashTable实现的HashSet就不一致了。HashSet根据对象的GetHashCode()返回值判断对象是否相等,而ListSet则使用对象的Equals()方法进行判断,所以如果没有注意重载GetHashCode()和Equals()方法,在保证唯一性上就有问题。HybridSet是Iesi.Collections中的一个混合类型,基于System.Collections.Specialized.HybridDictionary实现,主要是出于性能的考虑,内部实现会根据集合中对象的数量,自动在ListSet和HashSet两种类型间转换。
另外Iesi.Collections中的SortedSet允许提供一个IComparer接口,这样在列举集合对象时将按照IComparer提供的方法排序
解决办法:
- Nhibaernate 在使用Iset<>Invalid Cast错误
- NHibernate 错误原因:Invalid Cast (check your mapping for property type mismatches)
- assignment makes pointer from integer without a cast &错误:‘NULL’ 未声明 (在此函数内第一次使用)
- 在FormWizard中使用Django-sample-captcha一直出现"invalid captcha“错误
- cuda-convnet在Windows下的使用 错误(error:invalid device function)
- 在使用Volley进行网络获取的时候错误提示500,服返回Invalid chunk header
- cast使用
- 在使用python语言的open函数时,提示错误OSError: [Errno 22] Invalid argument: ‘文件路径’
- invalid cast from `GtkComboBoxEntry' to `GtkEntry'
- 如何在hibernate+mySQL中使用HQL的cast语句
- 在mysql中使用cast函数报错
- Mybatis - 在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Invalid bound statement (not found)-Mybatis在idea中错误
- CocoaPods使用中的invalid byte sequence in US-ASCII错误
- 使用javafx scenebuilde 添加controller 提示错误invalid
- 【多媒体封装格式详解】---FLV
- VC++ MFC文件的移动复制删除更名遍历操作
- SQL Server 2008 R2:纯SQL查看数据库描述文档
- Hibernate的merge()方法
- ural 1078 Segments
- Nhibaernate 在使用Iset<>Invalid Cast错误
- 如何在ashx页面获取Session值
- 【Android进阶】嵌套TabHost (TabHost中放TabHost,类似二级目录、二级树)
- 选择排序法 (Selection Sort)
- event.altKey、event.ctrlKey、event.shiftKey 属性
- Android Textview 延时加载图片
- What:数字信号基带传输的常用码型
- hdu 2438 暴力吧
- 乔纳森·伊夫