NHibernate的火鸟错误 – 索引超出范围
本文介绍了NHibernate的火鸟错误 – 索引超出范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么可以使用NHibernate和Firebird数据库时,会导致在C#下面的错误?
2015年8月17号08:27:04962 [21] [(NULL)]错误Smartsign.Server.Core.Server未处理的异常:System.ArgumentOutOfRangeException:索引超出范围。必须是非负和小于集合的大小。
参数名:索引
在System.ThrowHelper.ThrowArgumentOutOfRangeException()
在System.Collections.Generic.List`1.get_Item(的Int32索引)
在FirebirdSql.Data.FirebirdClient.FbParameterCollection.get_Item(的Int32指数) c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 58
在FirebirdSql.Data.FirebirdClient.FbParameterCollection.GetParameter(的Int32指数) c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 315
在System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(的Int32索引)
在NHibernate.Type.Int32Type.Set(IDbCommand的RS,对象的值,指数的Int32)
在NHibernate.Type.NullableType.NullSafeSet(IDbCommand的CMD,对象的值,指数的Int32)
在NHibernate.Type.NullableType.NullSafeSet(IDbCommand的ST,对象的值,指数的Int32,ISessionImplementor会话)
在NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(对象ID,对象[]字段,对象ROWID,布尔[] includeProperty,布尔[] [] includeColumns,的Int32表,IDbCommand的说法,ISessionImplementor会议的Int32索引)
在NHibernate.Persister.Entity.AbstractEntityPersister.Insert(对象ID,对象[]字段中,布尔[] NOTNULL,的Int32Ĵ,SqlCommandInfo SQL,obj对象,ISessionImplementor会话)
在NHibernate.Persister.Entity.AbstractEntityPersister.Insert(对象ID,对象[]字段,obj对象,ISessionImplementor会话)
在NHibernate.Action.EntityInsertAction.Execute()
在NHibernate.Engine.ActionQueue.Execute(IExecutable可执行文件)
在NHibernate.Engine.ActionQueue.ExecuteActions(IList的列表)
在NHibernate.Engine.ActionQueue.ExecuteActions()
在NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource会话)
在NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent事件)
在NHibernate.Impl.SessionImpl.Flush()
在NHibernate.Transaction.AdoTransaction.Commit()
解决方案
只是为了保持完整性。唯一的例外:
索引超出范围…
与NHibernate写操作主要是指:有加倍列映射。
通常相结合的<性>
和<许多一对一>
。同时检查:
What can cause the following error in c# when using NHibernate and Firebird database?
2015-08-17 08:27:04,962 [21] [(null)] ERROR Smartsign.Server.Core.Server Unhandled exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at FirebirdSql.Data.FirebirdClient.FbParameterCollection.get_Item(Int32 index) in c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 58
at FirebirdSql.Data.FirebirdClient.FbParameterCollection.GetParameter(Int32 index) in c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 315
at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)
at NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 index)
at NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index)
at NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
解决方案
Just for completeness. The exception:
Index was out of range…
with NHibernate WRITE operation mostly means: there is doubled column mapping.
Usually combination of the <property>
and <many-to-one>
. Also check:
NHibernate mapping index out of range
这篇关于NHibernate的火鸟错误 – 索引超出范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持蚂蚁编程!
1、本站所有文档、视频、书籍等资料均由网友分享,本站只负责收集不承担任何技术及版权问题。
2、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除下载链接并致以最深的歉意。
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责。
4、一经注册为本站会员,一律视为同意网站规定,本站管理员及版主有权禁止违规用户。
5、蚂蚁编程管理员有权不事先通知发贴者而删除本文。
蚂蚁编程学院 » NHibernate的火鸟错误 – 索引超出范围
2、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除下载链接并致以最深的歉意。
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责。
4、一经注册为本站会员,一律视为同意网站规定,本站管理员及版主有权禁止违规用户。
5、蚂蚁编程管理员有权不事先通知发贴者而删除本文。
蚂蚁编程学院 » NHibernate的火鸟错误 – 索引超出范围