While designing ORM, what is the best approach to represent the relationship, performance-wise? I mean, out of the following two, which approach is best considering performance?
class Employee
{
int ID { get; set; }
String Name { get; set; }
int DepartmentID { get; set; } //This approach uses DepartmentID
}
--- OR ---
class Employee
{
int ID { get; set; }
String Name { get; set; }
Department Department { get; set; } //This approach uses Department class
}
From my perspective, the second approach is nice. It is object oriented, too. And that should be the main purpose of ORM; to convert relationship from RDBMS to Object Oriented. But doing this, we would be required to load the entire Department object in an employee one, even though it is not required.
How should you represent or what should be the best approach, in your view?