I trying to use dynamic linq for runtime datagrid filtering with DataGridFiltering project.but i have a problem with enums.
for example, i have a class which contain an enum property like this :
public class Student
{
public Student(int id,string name,StudentType type)
{
Id = id;
Name = name;
Type = type;
}
public int Id { get; set; }
public string Name { get; set; }
public StudentType Type { get; set; }
}
and StudentType enum is :
public enum StudentType : byte
{
Normal=0,
Good
};
i create a controller class for work with list of students.
in my controller i have a method to find students by type.
this is FindByType Method:
public IList<Student> FindByType(string type)
{
return _students.AsQueryable().Where("Type.ToString().StartWith(@0)",type).ToList();
}
when i call FindByType Method i get this error in ParseMemberAccess method of dynamic linq:
Methods on type 'Enum' are not accessible