Hi!
I am using NHibernate and have a many-to-many association between an Employee and a Team.
Now I want to display all Employees with the name of its Team member.
Possibility 1:
- using AutoMapper and create a DTO containing the Employee properties and the name of the Team (eager load the Team)
- display the DTO in the view
Possibility 2:
- create a new Entity called EmployeeTeam and map it with NHibernate/FluentNHibernate (this entity acts as the relational table between the Employee and Team in the database)
- load TeamEmployee by using eager loading include Employee and Team
- display the EmployeeTeam entity
- use the EmployeeTeam members (EmployeeTeam.Employee.Name, EmployeeTeam.Team.Name)
Possibility 3:
- as possibilities 1 and 2
- using a DTO for the EmployeeTeam
Possibility 4:
- use ICriteria API
- use the AliasToBeanResultTransformer (didn't use this)
Possibility 5:
- use LINQ to NHibernate
- I think I will still need the EmployeeTeam Entity (which is for now not in my Domain Model)
What is the best practices for this problem?
Any other suggestions?