The Type Descriptors of the return parameter have already been defined with the same structure as we just built above. This is because when creating a new method, BDC designer will search the possible Type Descriptors defined in the other methods of this entity and copy them to the newly created methods.
In the EmployeeService class, replace the code with the code shown below.
public static IEnumerable<Employee> ReadList()
{
List<Employee> employees = new List<Employee>();
string connectionString = "Data Source=orcl;Persist Security Info=True;" +
"User ID=system;Password=password-1;Unicode=True";
using (OracleConnection connection = new OracleConnection())
{
connection.ConnectionString = connectionString;
connection.Open();
OracleCommand command = connection.CreateCommand();
string sql = "SELECT * FROM hr.employeedetails";
command.CommandText = sql;
OracleDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Employee employee = new Employee();
employee.Employee_ID = Convert.ToInt32(reader["Employee_ID"]);
employee.FirstName = Convert.ToString(reader["FirstName"]);
employee.LastName = Convert.ToString(reader["LastName"]);
employees.Add(employee);
}
}
return employees;
}