I will give it a try. Do I need to go through these steps in order to update FNH in Sharp Architecture?
http://groups.google.com/group/sharp-architecture/browse_thread/thread/f37a99ecfa681770# I have a question on mapping. Employee, a subclass of User, has a many- to-one relationship with Role. UserMapping.cs mapping.Map(x => x.Type); mapping.DiscriminateSubClassesOnColumn("Type") .SubClass<Employee>("E", m => { m.References(x => x.Role); }) I defined the relationship in domain model. User.cs public class Employee : User { public virtual Role Role { get; protected set; } } My question is that do I have to define the other side of relationship in Role.cs as well? Role.cs public class Role : Entity { public virtual string Name {get; set;} ??? public virtual IList<Employee> Employees {get; protected set;} ??? } If I do, I will have to do the same for RoleMapping.cs as well. mapping.HasMany(x => x.Employees) .Inverse() .KeyColumnNames.Add("Id") .AsBag(); 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 -~----------~----~----~----~------~----~------~--~---