Blog - Title

The Composability Thought Process for LINQ

The Composability Thought Process for LINQ

  • Comments 0

I’ve been thinking about how to demonstrate the thought process of developing a somewhat more involved query.  The main idea is to show how you can write queries on other queries, refactor as necessary, and inject / modify code while not making your code brittle.  I have been looking for a suitable problem to demonstrate incremental development of a more elaborate query, and finally found a good one in the current work that I’m doing for the PowerTools for Open XML project.  My task was to write some queries that find paragraphs based on their style or content.

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOC
The task is somewhat more complicated because I need to allow the developer to specify more than one style to find, and more than one string to find in the paragraph content.  In addition, if the method is searching on a style name, and there is a paragraph based on a style that inherits the style we’re looking for, the method should include that paragraph in its results.

In other words, we can search for all paragraphs that have any of a number of styles, or we can search for all paragraphs that contain in their content any number of search strings, or we can search for any number of paragraphs that are based on the specified styles AND contain any of the specified search strings.

In the post, “Finding Paragraphs by Style Name or Content in an Open XML Word Processing Document”, I incrementally develop this query, showing the code that I change with each successive iteration.  This shows, I think, how I go about writing a more elaborate query or set of queries.

Hope it’s useful.

Leave a Comment
  • Please add 3 and 2 and type the answer here:
  • Post