Scrap that... It appears that nullable columns in your database need to be nullable in your class... Obviously you say but the error message doesn't really give much indication as to that being the cause.
After setting the nullable columns to nullable, it worked a treat. Cheers On Jun 27, 12:00 pm, Gavin <[email protected]> wrote: > Afternoon All, > > I've got ActiveRecord working on a non-relational basis (without using > BelongTo) but my database schema is such that BelongsTo should work > without any issues. > > That said, when I try using BelongsTo, I seem to get the exception > below. > > Any suggestions? > > System.IndexOutOfRangeException: Invalid index 11 for this > SqlParameterCollection with Count=11. > at System.Data.SqlClient.SqlParameterCollection.RangeCheck(Int32 > index) > at System.Data.SqlClient.SqlParameterCollection.GetParameter(Int32 > index) > 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.Update(Object id, > Object[] fields, Object[] oldFields, Object rowId, Boolean[] > includeProperty, Int32 j, Object oldVersion, Object obj, > SqlCommandInfo sql, ISessionImplementor session) > at > NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object > id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] > includeProperty, Int32 j, Object oldVersion, Object obj, > SqlCommandInfo sql, ISessionImplementor session) > at > NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, > Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, > Object[] oldFields, Object oldVersion, Object obj, Object rowId, > ISessionImplementor session) > at NHibernate.Action.EntityUpdateAction.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 > Castle.ActiveRecord.Framework.SessionFactoryHolder.ReleaseSession(ISession > session) in c:\TeamCity\buildAgent\work\e41ee5ead2eba140\src > \Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:line 257 > at Castle.ActiveRecord.ActiveRecordBase.FindByPrimaryKey(Type > targetType, Object id, Boolean throwOnNotFound) in c:\TeamCity > \buildAgent\work\e41ee5ead2eba140\src\Castle.ActiveRecord\Framework > \ActiveRecordBase.cs:line 1218 > at Castle.ActiveRecord.ActiveRecordBase`1.TryFind(Object id) in c: > \TeamCity\buildAgent\work\e41ee5ead2eba140\src\Castle.ActiveRecord > \Framework\ActiveRecordBase.Generic.cs:line 451 > at Site.service.GetPatient(Guid patientID) in C:\Users\Gavin > \Documents\Projects\GreyMatters\Hypertension\Site\service.asmx.cs:line > 91 -- You received this message because you are subscribed to the Google Groups "Castle Project Development List" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en.
