I have a rather simple Database:
table NamedItem
Columns:
Id (PK)
Country (string)
Category (string)
MainName (string)
table AlternateNames
Columns:
NamedItemId (FK to NamedItem.Id)
AlternateName (string)
I want to have the following classes and enums to map to these two tables:
enum Country {Germany, England, Spain} //Name of enum value and country string in DB have to be the same
enum Category {A, B, C} //Name of enum value and category string in DB have to be the same
class Item { Guid ID {get;set;} ItemNames Names {get;set;}}
class ItemNames { string MainName {get;set;} IList<
string>
AlternateNames {get; set;}}
UPDATE:
The important thing is not the enums but that class ItemNames that contains parts from two different tables and is located in the entity of one of those tables.
Is this possible with NHibernate, preferably with Fluent NHibernate?
If so, please give me a jump start. I couldn't figure out, how to do it.
Kind regards,
Daniel
P.S. I posted the same question in the Microsoft Entity Framework forum, asking whether it is possible with EF4. Depending on the answers, I will choose the framework I will use. Just in case someone is wondering...