0

I have been working on a project where the requirements of the customer is to provide the configuration access of parsing the RSS Feed in XML Format to user according to his requirement. After selecting the different parameters, a query is generated (LINQ to XML) and all the filters like Value.StartsWith/EndsWith/Contains are unknown. There can be unlimited filters but not out of the above three (StartsWith/EndsWith/Contains). I have this query in a String variable.

My Question is that, can we execute a query generated at runtime after the users selections ? The query is more likely to look like this

xmldoc.Descendants("item")
      .Where(c =>c.Element("description").Value.StartsWith("some text") 
             && c.Element(description).Value.Contains("some text") 
      .Select(c => c.Element(description).Value).Single();

If anyone knows that, is this possible or not. If yes where should i look next. thanks

Jibran Khan
  • 3,236
  • 4
  • 37
  • 50

1 Answers1

0

Yes it's possible. My favorite variant is to use PredciateBuilder to dynamicly build queries.

Guru Stron
  • 102,774
  • 10
  • 95
  • 132