I am currently using an enumeration in NHibernate, displayed as follows.
public enum UploadMethod { Java, Silverlight, Gears, Flash } class UploadMethodType : EnumStringType { public UploadMethodType() : base(typeof(UploadMethod), 255) { } } public class Person { /* Bunch of non interesting properties... */ public UploadMethod PreferredUploadMethod { get; set; } } <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="Person" lazy="false" table="[dbo].[People]"> <property name="PreferredUploadMethod" type="UploadMethodType" /> </class> </hibernate-mapping>
Which works fine, except that the database is far from normal, each row in the People table has a column containing one of four text rows. Now I have split this into a new table, but I'm not sure how to create a mapping in NHibernate. My first instinct was just <many-to-one> , but I do not want this listing to be his own essence. I just need NHibernate to do a simple join to bind to an extra column.
As a stop gap, I just created a view that works great, but I would prefer the abstraction layer to be in my NHibernate map rather than in the schema.
c # nhibernate nhibernate-mapping
Jeff mc
source share