C#, regex, and expression trees. Design advice? RRS feed

  • Question

  • Hi,

    I'm at the beginning of trying to figure this out and would like to see if anyone might have some good advice.

    I have a set of objects, each of which has a property bag. there are a known set of properties in each bag. I need to create a generic impl that will match on these using boolean logic.

    Here's my idea so far, represented as Sql tables:

    Table_PropAssociation(ID, PropName, RegEx)
    Example rows: {PA1, 'MimeType', '^Foo'}, {PA2, 'MimeType', '^Bar'}, {PA3, 'Path', '^Root2'}
    Table_PropAssociationExpression(Expression, Action)
    Example row: '(PA1 AND PA3) OR PA2','DoThisAction'

    For this impl, any suggestions in C# of how to impl this? Does C# have any type of built in logical expression parsers that would help? Does this seem like a sensible idea?

    The idea needs to be relatively simple (the example above is as complex as it should get) and fast.

    Wednesday, June 13, 2007 6:09 PM