Fluent API .Contains(variable)
When using the Fluent API if I hard code a value in a .Contains (.Contains("x")) then I get results. If I use a variable I always get an empty result set (.Contains(strSearchString)).
Example:
public IQueryable<ContentItem> GetGenericContent(string strTag, string strSearch)
var taxManager = TaxonomyManager.GetManager();
var taxon = taxManager.GetTaxa<FlatTaxon>().Where(t => t.Name == strTag).Single();
Guid guidid = taxon.Id;
ContentManager manager = ContentManager.GetManager();
IQueryable<ContentItem> contentItem = manager.GetContent()
.Where(t => t.Content.Contains(strSearch))
.Where(t => ((IList<Guid>)t.GetValue("Tags")).Contains(guidid))
.Where(t => t.Status == ContentLifecycleStatus.Live);
return contentItem;
the same code will work if I switch the line containing the .Contains(strSearch) to .
Where(t => t.Content.Contains("e"))
it will pick up all content items that contain an "e".
Hi Joe,
Thank you for using our service.
This is an issue with the built in Sitefinity OQL parser which cannot translate the lambda expression to the proper SQL statement so that it filters for the search text. We are currently in the process decommissioning the OQL parser and substituting it with the Telerik OpenAccess built in OQL parser which has better support for lambda expressions.
Kind regards,
Radoslav Georgiev
the Telerik team
Hi Radoslav,
Thank you for the reply. Is there an estimate on the date when the OQL parser will be replaced?
Joe
Hello Joe,
We are trying to push this migration for the 2011 Q1 release. Unless something critical pops up the OQL parser should be substituted within a month.
Greetings,
Radoslav Georgiev
the Telerik team
Hey Sitefinity,
This issue is still present in
Sitefinity 4.0.1210.0 SE
Hello Blake,
Sitefinity 4.1 (which will contain the Lamba expressions fix) will be released later today. The Sitefinity 4.0 SP1 release does not contain the fix.
Kind regards,
Radoslav Georgiev
the Telerik team