Complex mapping of columns and tables in NHibernate?

Just map the class up as if it was a normal string datatype. NH will call the ToString method of the value in effect saving the text value of the enum to the database.

Just map the class up as if it was a normal string datatype. NH will call the ToString method of the value in effect saving the text value of the enum to the database. So you mapping might look something like: public partial class ItemMap : ClassMap { Table( "NamedItem" ) ; Id(x => x.Id, "Id" ) .Not.Nullable() .GeneratedBy.Guid(); Map( x => x.

Country ) . Column( "Country" ) .Not. Nullable( ) .

Length( 255 ) ; Map( x => x. Category ) . Column( "Category" ) .Not.

Nullable( ) . Length( 255 ) ; ... HasMany( x => x. ItemNames ) .KeyColumns.

Add( "NamedItemId" ) . Table( "AlternateNames" ) . LazyLoad( ) .Cascade.

None( ) .AsSet() ; ... } and a class similar to public class Item { public virtual Guid Id { get; set; } public virtual CountryType Country { get; set; } public virtual CategoryType Category { get; set; } ... public virtual ISet AlternateNames {get; set;} ... } I have the collection set to a set as that stops duplicates being in the collection which can sometimes cause issues.

Thanks for your answer! Unfortunatelly, it seems I haven't been specific enough about my problem: The problem is not with the enums but that class ItemNames. Notice that in my Item class there is no list of alternate names and no main name, but those are in that subclass.

Also, AlteranateNames is a list of string. Not of any "special" entity type... I updated my question. – Daniel lgarth Jan 13 at 8:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions