'Linq to Entites Issue
I am trying to use dynamic Linq in my project but have following Issue.
Invoice Class
public string ClientName { get; set; }
public TransactionType TransactionType { get; set; }
TransactionType Enum
public enum TransactionType
{
ServiceInvoice = 0,
CreditInvoice = 1,
Payment=2
}
Simple Linq is working like excepted.
var incoicestest2 = _unitOfWork.GetRepository<Invoice>().Select().Where(x => x.TransactionType.ToString().Contains("ServiceIn"));//Working
but Dynamic Linq is not working
var SearchString="TransactionType.ToString().Contains (\"ServiceIn\")";
var incoicestest2 = _unitOfWork.GetRepository<Invoice>().Select()
.Where(SearchString)
.ToList(); //Not Working
And Error "LINQ to Entities does not recognize the method 'System.String ToString()' method,..."
I need to use Dynamic Linq because the searchString is created at run time.
Someone Help ,Please
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
