This question is locked. New answers and comments are not allowed.
Hi,
I am trying to do something along the lines of
When using this expression in a linq select against a LinqToEntitiesDomainService works prefectly
When using it against an openaccessdomainservice it fails with a null reference exception.
It took me ages to resolve this but in the end it only took a small change. Changing
to
allows the query to run successfuly. Even putting "Param_0" which is what the first parameter constructor would use internally still works fine. I thought this 2nd name parameter was purely used for debugging and printing purposes ?
I think I have a fix which is fine but something doesn't feel quite right
Regards
Steve Hayles
I am trying to do something along the lines of
private
static
Expression<Func<Customer, string>> CreateSelectorExpression(string propertyName)
{
var paramterExpression = Expression.Parameter(typeof(Customer));
return (Expression<Func<Customer, string>>)Expression.Lambda(Expression.PropertyOrField(paramterExpression, propertyName), paramterExpression);
}
When using this expression in a linq select against a LinqToEntitiesDomainService works prefectly
When using it against an openaccessdomainservice it fails with a null reference exception.
It took me ages to resolve this but in the end it only took a small change. Changing
var paramterExpression = Expression.Parameter(typeof(Customer));
to
var paramterExpression = Expression.Parameter(typeof(Customer), "ANYTHING_HERE);
allows the query to run successfuly. Even putting "Param_0" which is what the first parameter constructor would use internally still works fine. I thought this 2nd name parameter was purely used for debugging and printing purposes ?
I think I have a fix which is fine but something doesn't feel quite right
Regards
Steve Hayles