Mapping custom enum classes with Fluent Nhibernate

enums, fluent-nhibernate, nhibernate-mapping

Solution

Ah... it was easy. In CodeCampServer - there's a generic EnumerationType class. Idea is simple - we just need to wrap our domain model enumeration value object with EnumerationType in order to map it as integer (or anything else if necessary).

Problem

Reading some posts from Jimmy Boggard and wondering - how exactly is it possible to map those beasts with fluent nhibernate? How mapping would look like for this? ``` public class EmployeeType : Enumeration{ public static readonly EmployeeType Manager = new EmployeeType(0, "Manager"), Servant = new EmployeeType(1, "Servant"), AssistantToTheRegionalManager = new EmployeeType (2, "Assistant to the Regional Manager"); private EmployeeType() { } private EmployeeType(int value, string displayName) : base(value, displayName) { } } ```

Original source