1
votes

Kendo Filter

if ($.trim(DepartmentId)) { $filter.push({ field: "DepartmentId", operator: "eq", value: DepartmentId  }); }

Model

public System.Guid DepartmentId { get;  set; }

Method

[Queryable]
    public IQueryable<Employee> Get(ODataQueryOptions opts)
    {
        EmployeeService.HrEmployeeServiceFacadeClient emp = new EmployeeService.HrEmployeeServiceFacadeClient();
        var response = emp.GetAll();
        List<Employee> result = JsonConvert.DeserializeObject<List<Employee>>(response.Result);
        var resultString = result.AsQueryable();

        return resultString;
    }

I'm Using OData 2.2

Its showing Error

A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'.

1

1 Answers

4
votes

In OData v2, a literal GUID must be serialized as guid'dddddddd-dddd-dddd-dddd-dddddddddddd' where each d represents a hexadecimal digit.