Storing expression references to data base
- by Marcus
I have standard arithmetic expressions sotred as strings
eg. "WIDTH * 2 + HEIGHT * 2"
In this example WIDTH and HEIGHT
references other objects in my system and the literals
WIDTH and HEIGHT refers to a property (Name) on those
objects.
The problem I'm having is when the Name property on
an expression object changes the expression won't match
anymore.
One solution I came up with is to instead of storing
"WIDTH * 2 + HEIGHT * 2"
i store
"{ID_OF_WIDTH} * 2 + {ID_OF_HEIGHT} * 2"
And let my parser be able to parse this new syntax
and implement an interface or such on referenced objects
IExpressionReference
{
string IdentifierName { get; }
}
Anyone have a better/alternative solution to my problem?