Currently I am trying this way. Is this right way of doing? Please suggest. This one executing query for each child record.
EmployeeEntity employee = new EmployeeEntity(contract.EmployeeId);
DataAccessAdapter adapter = LLBLGenAdapterUtility.GetAdapter();
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.EmployeeEntity);
// filter for Phone
IPredicateExpression phoneFilter = new PredicateExpression();
phoneFilter.AddWithAnd(EmployeePhoneFields.SysDelete == false);
prefetchPath.Add(EmployeeEntity.PrefetchPathEmployeePhoneCollectionByEmployeeId, 0, phoneFilter);
// filter for language
IPredicateExpression languageFilter = new PredicateExpression();
languageFilter.AddWithAnd(EmployeeLanguageFields.SysDelete == false);
prefetchPath.Add(EmployeeEntity.PrefetchPathEmployeeLanguageByEmployeeId, 0, languageFilter);
adapter.FetchEntity(Employee, prefetchPath);
foreach (EmployeePhoneEntity phone in employee.EmployeePhoneCollectionByEmployeeId)
{
prefetchPath = new PrefetchPath2((int)EntityType.EmployeePhoneEntity);
prefetchPath.Add(EmployeePhoneEntity.PrefetchPathEmployeeTypeRefByPhoneTypeId);
adapter.FetchEntity(phone, prefetchPath);
}
foreach (EmployeeLanguageEntity language in employee.EmployeeLanguageByEmployeeId)
{
prefetchPath = new PrefetchPath2((int)EntityType.EmployeeLanguageEntity);
prefetchPath.Add(EmployeeLanguageEntity.PrefetchPathLanguageRefByLanguageId);
adapter.FetchEntity(language, prefetchPath);
}