I need to know about using PredicateBuilder . In almost every code usage example, they display the code as follows:
var predicate = PredicateBuilder.True<employee>(); if (!string.IsNullOrEmpty(txtAddress.Text)) predicate = predicate.And(e1 => e1.Address.Contains(txtAddress.Text)); if (!string.IsNullOrEmpty(txtEmpId.Text)) predicate = predicate.And(e1 => e1.Id == Convert.ToInt32(txtEmpId.Text)); if (!string.IsNullOrEmpty(txtDesc.Text)) predicate = predicate.And(e1 => e1.Desc.Contains(txtDesc.Text)); if (!string.IsNullOrEmpty(txtName.Text)) predicate = predicate.And(e1 => e1.Name.Contains(txtName.Text)); EmployeeDataContext edb= new EmployeeDataContext(); var emp = edb.Employees.Where(predicate); grdEmployee.DataSource = emp.ToList(); grdEmployee.DataBind();
What is an Employee object that is between the brackets larger and smaller? I put brains on him. I use Linq for SQL entities, and I get compilation errors when I do this myself. I think errors are something like:
"Cannot translate from Linq table to ..."
I'm new at this. Please forgive me for asking what might be obvious. Thanks.
source share