← All articles

RuleSetDialog & LINQ Queries

Can you use LINQ inside the WF RuleSetDialog editor? No. Here's why it fails validation and a workaround using properties and methods instead.

Donn Felker

Donn Felker

2008.10.02 · 1 min read

I’m working on a presentation for the Twin Cities Code Camp and I’ve upgraded some old samples that Microsoft provided for the new version of .NET 3.5. Upon doing so I imagined the question coming up during the presentation “Well, can we use LINQ in the rule set editor”? Good question.

And here’s the simple answer: NO.

Check it out – this it the validation error from the RuleSetDialog editor.

image

In my opinion the editor should allow this, but alas it doesn’t as this would be rather difficult to represent in the serialized RuleSet file. This might be an issue with the form supporting code definitions in the conditional window, which is probably a whole new bunch of problems.

I have also looked to extend the form but this does not look possible and from a few forum posts I’ve read Microsoft does not want you extending this control. Bummer man.

Hacky Fix

Place all of your LINQ code style items in Properties or methods that you can then access from the Condition window. Not a superb answer, but it works in a bind.

Donn Felker

Written by Donn Felker

I've spent 25+ years shipping software, writing books, and running my own companies. I write about thinking clearly, working for yourself, and doing real work while AI rewrites the rules. New essays land here every week.

Get the newsletter

Keep reading