dạ hiện ngay chổ dbNullExp nó chạy đến đó là báo null ạ e sử dụng mongoDB dạ e chưa biết nguyên nhân sai là do đâu hết ạ
public List<Sach> ListName(string keyWord)
{
Func<Sach, bool> isPositive = delegate (Sach sach)
{
return (ConvertToUnSign(sach.TenSach).IndexOf(keyWord, StringComparison.CurrentCultureIgnoreCase) >= 0) ? true : false;
};
var dbNullExp = Expression.Field(expression:null, type: typeof(Sach), fieldName: "Value");
Expression<Func<Sach, bool>> idFunc = Expression.Lambda<Func<Sach, bool>> (Expression.Call(isPositive.Method, dbNullExp));
var List = _DatabaseCollection.Find(idFunc).ToList();
//var lita = SearchFor(idFunc);
return List;
}
private string ConvertToUnSign(string input)
{
input = input.Trim();
for (int i = 0x20; i < 0x30; i++)
{
input = input.Replace(((char)i).ToString(), " ");
}
Regex regex = new Regex(@"\p{IsCombiningDiacriticalMarks}+");
string str = input.Normalize(NormalizationForm.FormD);
string str2 = regex.Replace(str, string.Empty).Replace('đ', 'd').Replace('Đ', 'D');
while (str2.IndexOf("?") >= 0)
{
str2 = str2.Remove(str2.IndexOf("?"), 1);
}
return str2;
}