I'm trying to run a custom method in subsonic query. Here is my query:
Page = Pages.SingleOrDefault(o=>Misc.MakeURL(o.Title) == URL);
and I'm getting this error:
The method 'MakeURL' is not supported
I'm using Subsonic 3. Any ideas would be great, thanks.
This is simply not possible,
subsonic translates your expression to SQL, so
Pages.SingleOrDefault(o => o.Title == "title");
will propably generate a similar query like this
SELECT * FROM pages WHERE title = 'title' LIMIT 1
and you are expecting subsonic to convert your MakeUrl(...) method into SQL. What do you expect?
SELECT * FROM pages WHERE MAKEURL(title) = 'title' LIMIT 1
However, you can either just query the title or call ToList() on your pages, but that will pull all records from the database.
Page = Pages.ToList().SingleOrDefault(o=>Misc.MakeURL(o.Title) == URL);