Thank you for the suggestion. However, i need something at a lower level,
the hql ast level.
On May 23, 2013 11:09 AM, "Ricardo Peres" <[email protected]> wrote:

> You can do it with a custom interceptor (a class derived from
> ExpressionVisitor), like this:
> http://weblogs.asp.net/ricardoperes/archive/2013/05/23/intercepting-linq-queries.aspx
> .
> Look for a BinaryExpression where some property (left value) is being
> compared to null (right value) and replace the right value for "".
>
> RP
>
> On Friday, May 17, 2013 1:48:31 PM UTC+1, pvginkel wrote:
>>
>> We're in the process of converting a legacy application to NHibernate.
>> One of the "interesting" aspects of this application is that part of it is
>> written in Magic <http://www.magicsoftware.com/>, which does not allow
>> columns to have NULL, but instead requires it to have a space. This means
>> that some tables do not allow NULL in string columns, and some tables do.
>>
>> I have already implemented some functionality to hide this fact using a
>> few IType implementations. These work nicely and loading and saving
>> entities already automatically convert spaces to NULL's.
>>
>> However, I can't seem to find a way to fix querying. We're primarily
>> using LINQ as our query mechanism, and I would like the following:
>>
>> db.Addresses.Where(p => p.Street == null)
>>
>> to be converted to:
>>
>> where o.Street = ' '
>>
>> instead of:
>>
>> where o.Street is null
>>
>> I've already implemented some custom LINQ functions, but because the
>> developer does not know what fields to apply these functions to, I would
>> very much prefer an automated mechanism. I have the feeling the best way to
>> accomplish this may be using a custom HQL AST visitor (maybe there are
>> better solutions), but I can't seem to find an extension point to provide
>> something like that.
>>
>> What is the best way to get this to work?
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "nhusers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nhusers/58GRDMwwzPA/unsubscribe?hl=en-US
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to