Here I have two similar ways of populating a simple Employee class.
I'm trying to work out the pros & cons of each method.
1) Seems simpler but tightly-coupled to the DAL(Data Access Layer)
1)
I'm trying to work out the pros & cons of each method.
1) Seems simpler but tightly-coupled to the DAL(Data Access Layer)
1)
Code:
class Employee
{
public int ID;
public string Forename;
public string Surname;
public Employee(int ID)
{
// Fill this Employee with values
DAL.GetEmployee(this, ID)
}
}
Employee emp = new Employee(5)
2)
class Employee
{
public int ID;
public string Forename;
public string Surname;
}
Employee emp = DAL.GetEmployee(5);
[code]
What are your views on the best method?