Hi!

I created a simple projection from an entity to a DTO with a child.

If the expression contains a null check for the child, NHibernate makes a 
full query, ignoring the projection:
Expression<Func<Customer, CustomerDto>> works =
x =>
new CustomerDto
{
Name = x.Name,
Address = new AddressDto{ Number = x.Address.Number }
};

Expression<Func<Customer, CustomerDto>> doesntWork =
x =>
new CustomerDto
{
Name = x.Name,
Address = x.Address == null ? null : new AddressDto{ Number = 
x.Address.Number }
};

So the LINQ provider is not able to parse the IIF condition, right?

Is there a way to fix?

Thanks,
Matteo Migliore

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to