I have a generic class HierarchicalBusinessObject. In the constructor of the class I pass a lambda expression that defines a selector to a field of TModel.
protected HierarchicalBusinessObject
(Expression<Func<TModel,string>> parentSelector)
A call would look like this, for example:
public class WorkitemBusinessObject :
HierarchicalBusinessObject<Workitem,WorkitemDataContext>
{
public WorkitemBusinessObject()
: base(w => w.SuperWorkitem, w => w.TopLevel == true)
{ }
}
I am able to use the selector for read within the class. For example:
sourceList.Select(_parentSelector.Compile()).Where(...
Now I am asking myself how I could use the selector to set a value to the field. Something like selector.Body() .... Field...