Why does this throw a System.NotSupportedException ?
string foo(string f) { return f; } string bar = ""; var item = (from f in myEntities.Beer where f.BeerName == foo(bar) select f).FirstOrDefault();
Edit: Here's an MSDN link that (kind of) explains things ...
Any method call in LINQ for query objects that is not explicitly mapped to a canonical function will result in a run-time NotSupportedException exception. For a list of CLR methods that map to canonical functions, see the CLR method for Canonical Function Mapping.
See also http://mosesofegypt.net/post/LINQ-to-Entities-what-is-not-supported.aspx
EDIT: , , , foo(). , SQL.
foo()
- (, string.StartsWith), , foo - foo() - . SQL.
string.StartsWith
foo
, . IQueryable<> where (, , , LINQ SQL).
IQueryable<>
where
. ToList() SingleOrDefault().
ToList()
SingleOrDefault()
, , SQL- , foo(), .
Source: https://habr.com/ru/post/1742951/More articles:How to translate hostname using Ruby net-mdns? - ruby | fooobar.comRestore project name? - open-sourceWhat variables can I get the syntax $ {...} in the Struts tag on the JSP page for? - javaТочность DATEIFF SQL Server - sqlGWT: Incorrect Key Codes Created Using the French Keyboard - gwtbest framework на gae (python), например jquery на javascript? есть это? - pythonAlgorithm used to make recommendations in Google News? - algorithmto download the source code jdk1.5.0_18 - javaRemove or disable username for users in Django - djangoUnity Framework - passing integers and strings to allowed objects - c #All Articles