Using enum strings with NHibernate persistence - level 400

Posted by: Jeffrey Palermo, on 14 Mar 2006 | View original | Bookmarked: 0 time(s)

One of the things that is not very obvious when using NHibernate is how to using Enumerations.  If you merely map an enum with the hbm.xml, NHibernate will persist that class member as an int, which is the underlying type of an Enum value type.  Even if you have your database table configured with a string field, you'll get an integer in your string field.To have NHibernate use the string representation of the enum for storing in the database, you need to use a special type class. ...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: XML | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1181 | Hits: 147

Similar Posts

  • Binding a ComboBox to Enum Values with RadControls for Silverlight more
  • Using Enums in List Controls more
  • VB Curiodities #1: Enum, Enum, my kingdom for an Enum.Parse more
  • Getting MAX with XSLT more
  • Creating FF Schemas in Biztalk - Different Approach more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD