tags:

views:

49

answers:

1

Hi there! We are trying to switch our project to NHibernate and i'm having this one problem: I have two similar tables in my DB: T_CATS (ID, NAME, TYPE) - All NUMBER types, T_MISC(ID, NAME, PARENT): This table is an old table that we can't change.. It houses a number of independent ENUMS (I Know the optimal way is to store each enum in a separate table) And the enums are separated by the tree like hierarchy (The real hierarchy levels don't matter).

One of the enums in this table is the enum that's connected to the TYPE field in the T_CATS table (The other enums are used by other tables/objects). I Want my objects to look like this

    public enum CatType
{
    Cute,
    Ugly,
    Evil
}

    public class Cat
{
    public int id { get; set;}
    public string name { get; set; }
    public CatType type { get; set; }
}

My question is how can I map this strange table into separate enums? and separate them by their hierarchy?

A: 

The question isn't clear. Are you trying to dynamically create enum objects in your application layer based on a list in a database table? What does the hierarchy have to do with your enums?

LeMiL