Hello.
I have a very simple problem about sorting.
I have an entity called ActionList (properties: int id, string name, table ACTIONLISTS). And I have an entity Action (properties: int id, string description, table ACTIONS).
What's the most correct strategy here if I want the ActionList to contain 1 to N actions but keeping the actions with a specific order?
a) Have a foreign key in ACTIONS which goes to the id of the ACTIONLISTS, and an int attribute called "order", and let the application worry about not putting duplicate entries in the same order inside a list (no referencial integrity). This is the most easier to implement with NHibernate.
b) Have an external table, called ACTIONS_ACTIONLISTS, which contains the ID of the ACTION, the ID of the ACTIONLIST, and the sort order, in which the primary key is the LISTACTIONID+SORT_ORDER, so as to keep the most perfect referential integrity. How can I deal with this working with NHibernate?
Thanks in advance.
|