Can you verify what the version number is of FNH you're using? The many-to-one looks wrong because in 1.0 we don't even generate a column attribute, we always create a column element.
On Fri, Aug 14, 2009 at 2:46 PM, Roger <rcjproj...@yahoo.com> wrote: > > After updating my copy of FNH and other dlls, I am still getting the > same error. i.e. > > ---> NHibernate.MappingException: Could not compile the > mapping > document: (XmlDocument) ---> System.IndexOutOfRangeException: Index > was outside the bounds of the array. > at NHibernate.Mapping.Column.set_Name(String value) > > In the generated User.hbm.xml, the column attritube of the many-to- > one element is still empty: > > <class name="AltNetTime.Core.User, AltNetTime.Core, > Version=1.0.0.0, > Culture=neutral, PublicKeyToken=null" table="Users" > xmlns="urn:nhibernate-mapping-2.2"> > <id name="Id" type="Int32" unsaved-value="0" column="Id"> > <generator class="identity" /> > </id> > <discriminator column="Type" type="String" /> > <property name="Type" type="String"> > <column name="Type" /> > </property> > <subclass name="AltNetTime.Core.Employee, AltNetTime.Core, > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" discriminator- > value="E"> > <many-to-one name="Role" column="" /> > </subclass> > </class> > > Is this a bug that needs to be fixed? Thanks. > > > On Aug 13, 3:45 am, James Gregory <jagregory....@gmail.com> wrote: > > Looks like a bug, I'd advise updating your copy of FNH. > > > > > > > > On Thu, Aug 13, 2009 at 5:29 AM, Roger <rcjproj...@yahoo.com> wrote: > > > > > I haven been using the latest release of Sharp Architecture with > > > Fluent Nhibernate. I ran into this error: > > > > > ---> NHibernate.MappingException: Could not compile the mapping > > > document: (XmlDocument) ---> System.IndexOutOfRangeException: Index > > > was outside the bounds of the array. > > > at NHibernate.Mapping.Column.set_Name(String value) > > > > > Here is my domain model (a simplified version): > > > > > public class User : Entity > > > { > > > public virtual string Type { get; set; } > > > } > > > > > public class Employee : User > > > { > > > public virtual Role Role { get; protected set; } > > > } > > > > > public class Role : Entity > > > { > > > public virtual string Name {get; set;} > > > } > > > > > The error came from the User mapping. Here is my UserMap.cs. I use > > > "Type" as a discriminator column: > > > > > mapping.Map(x => x.Type); > > > > > mapping.DiscriminateSubClassesOnColumn("Type") > > > .SubClass<Employee>("E", m => { m.References(x => x.Role); }) > > > > > Here is the hbm.xml. I noticed that the column attribute of the many- > > > to-one element is empty. Is that reason why the error occurred? If it > > > is, how do I set the column fluently? I tried using SetAttribute(). > > > Also, I tried implementing IReferenceConvention. But neither seemed to > > > work. Thanks. > > > > > <class name="AltNetTime.Core.User, AltNetTime.Core, Version=1.0.0.0, > > > Culture=neutral, PublicKeyToken=null" table="Users" > > > xmlns="urn:nhibernate-mapping-2.2"> > > > <id name="Id" type="Int32" unsaved-value="0" column="Id"> > > > <generator class="identity" /> > > > </id> > > > <discriminator column="Type" type="String" /> > > > <property name="Type" type="String"> > > > <column name="Type" /> > > > </property> > > > <subclass name="AltNetTime.Core.Employee, AltNetTime.Core, > > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" discriminator- > > > value="E"> > > > <many-to-one name="Role" column="" /> > > > </subclass> > > > </class>- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---