в простом примере, подобном этому
var query = db.From<Employee>()
.Join<Department>()
.OrderBy(e => e.Id)
.Select<Employee, Department>((employee, department) => new {
employee.Id,
employee.LastName,
DepartmentName = department.Name
}
);
если у меня есть класс, определенный для типа возвращаемого значения
public class EmployeeWithDept {
public int Id {get;set}
public string LastName {get;set}
public string DepartmentName {get;set}
}
Могу ли я явно написать свой .Select()
для возврата EmployeeWithDept
?
var query = db.From<Employee>()
.Join<Department>()
.OrderBy(e => e.Id)
.Select<Employee, Department>((employee, department) => new EmployeeWithDept {
employee.Id,
employee.LastName,
DepartmentName = department.Name
}
);