For those who have some tables within the database that strictly contain a string description as well as an ID, what's the easiest method to load these via NHibernate?

So suppose I've got a Sandwich class, along with a sandwich includes a meat, a cheese, along with a vegetable, where individuals three situations are research tables within the DB. It appears to become probably the most conformant to NHibernate philosophy to possess

public class Meat { string name; int id; }
public class Cheese { string name; int id; }
public class Vegetable { string name; int id; }
public class Sandwich { Meat meat; Cheese cheese; Vegetable vegetable; }

However with a couple of dozen tables such as this within the database, classes appear to proliferate rapidly. Suppose I arrange it such as this:

public class NameAndID { string name; int id; }
public class Sandwich { NameAndID meat; NameAndID cheese; NameAndID vegetable; }

Is achievable? How will it be implemented in Fluent NHibernate?

You'd need another column to look for the type. You could utilize an enum for your. Then all of your searches have to bring that restriction....

CreateCriteria<NameAndID>.Add(Restrictions.Eq("ntype", E.Meat)

However, I'd prefer separate tables so that you can have better foreign secrets. Otherwise there's nothing in database constraints to prevent you from creating a sandwich that's simply 3 bits of cheese.