'LINQ where condition with string operations
I get this error when that linq code runs. I try many string methods like concat,join,etc. But LINQ doesn't permit string operations. Finally error is runtime error.
ERROR: System.NotSupportedException: 'System.String Format(System.String, System.Object, System.Object)'
public List<ItemEntity> GetItems(List<string> codeList)
{
return ExecuteCrud(session =>
{
return (from Item in session.Query<ItemEntity>()
where (codeList.Contains(Item.code) || codeList.Contains($"{Item.Id.ToString().PadLeft(10, '0')}-{ Item.ItemId.ToString().PadLeft(12, '0')}"))
select Item).ToList();
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
