Getting error while executing the below code Error:Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
public ICollection<Employee> GetEmployeeDataList(RetriveEmployeeDetailsOnEntity request)
{
ICollection<Employee> returnValue = null;
SectionManagerHr.Execute(() =>
{
using (var tx = _Dao.Session.BeginTransaction())
{
var query = getEmployeeDataQuery(request);
returnValue = query.List();
tx.Commit();
}
});
return returnValue;
}
private IQueryOver<Employee> getEmployeeDataQuery(RetriveEmployeeDetailsOnEntity request)
{
Employee employee = null;
EmployeeData employeeData = null;
EmployeePayrollDefinition employeePayrollDefinition = null;
var query = _Dao.Session
.QueryOver(() => employee)
.JoinAlias(() => employee.EmployeeDataList, () => employeeData, JoinType.LeftOuterJoin)
.JoinAlias(() => employee.EmployeePayrollDefinitionList, () => employeePayrollDefinition, JoinType.LeftOuterJoin)
.TransformUsing(Transformers.DistinctRootEntity)
.Where(() => employee.CompanyEntityId == request.EntityId);
return query;
}