"Lose your memory in a thousand places, disappearing in a sea of faces, always alone, I live the only way I know" (John Miles)
Blog
About me
CV
Portfolio
Categories:
IT
Music
Site News
Personal
General stuff
ASP.NET
Databases
LINQ
On This Page
No Entries on this page
Links
-
Dominic Pettifer
-
Pierre Schavey
-
Tom Mertens
-
Bart De Smet
-
Wittawat (Ice) Keawcharoen
-
Windows Vista Developers Centre
-
The Code Project
Archive
July 2009 [2]
June 2009 [2]
May 2009 [1]
March 2009 [1]
February 2009 [2]
January 2009 [1]
December 2008 [1]
November 2008 [1]
May 2008 [2]
April 2008 [2]
March 2008 [6]
February 2008 [3]
January 2008 [6]
December 2007 [1]
November 2007 [1]
October 2007 [3]
August 2007 [4]
July 2007 [1]
May 2007 [1]
April 2007 [2]
February 2007 [2]
January 2007 [2]
Copyright 2007
Littlefool
Blog
>
IT
|
Databases
>
Map char values to enums using NHibernate Custom Types
> Comments
Map char values to enums using NHibernate Custom Types - Comments
Back to Blog-Entry
Images (0)
3 Comments
Hey, that's an awesome feature, I guess NHibernate has some very powerful mapping capabilities. Just wondering, what if you used an external lookup table for those statuses, could you still map them as enums? I'm planning on using a DDD (Domain Driven Design) approach for my next project and will probably implement statuses as enums throughout.
Posted by
Dominic Pettifer
on Sunday, July 05, 2009
I guess you can also map them to an enumerator using this technique, but you'll be missing some things. You're using mostly a table because your statuses are likely going to change (add new ones, remove old ones). If you'll be using Enums, you will need to recompile and deploy again because the Enum will be in your code. I have currently a simular situation in my project where we have a table with statuses linked to another table. I just implemented it with a normal one-to-one mapping between 2 objects (for now). Let me know if you find a better solution ;)
Posted by
Ronald
on Tuesday, July 07, 2009
This is poopin awesome!! I took it and genericized it to work with any enum (eg, new EnumCharType(Type enumType, char defaultVal). Email me for the code.
Posted by
Jeff Hagen
on Sunday, November 08, 2009
Name:
E-mail:
Homepage:
Comment (no HTML):