Thanks for answers and for interesting article.
On 19 Mar, 01:19, Andy Hitchman <[email protected]> wrote: > I recently blogged > (http://andyhitchman.wordpress.com/2009/03/13/specification-pattern-li...) > about this. My example regards the specification pattern rather than a > method call on the entity, but you may be able to take something away > from the post. > > Hope it helps. > > On Thu, Mar 19, 2009 at 12:57 AM, Alessandro C. > > <[email protected]> wrote: > > > I found this workaround: > > > .Where( > > ddt => // don't work with Linq2NHibernate > > (ddt.IsClose() == false) && > > (ddt.NotReadyToUse == false) && > > (customer == null || ddt.Ddt.Customer == customer) > > && > > (article == null || ddt.Article == article)) > > .OrderBy(ddt => ddt.Ddt.Dateddt) > > .ToList() > > .Where(ddt => ddt.IsClose() == false ); > > > Is that the right way? > > > Thanks, > > > On 18 Mar, 11:35, "Alessandro C." <[email protected]> > > wrote: > >> I'm using Linq to NHibernate and I have problem using a query like the > >> following (fragment): > > >> .Where( > >> ddt => (ddt.IsClose() == false) && > >> (ddt.NotReadyToUse == false) && > >> (customer == null || ddt.Ddt.Customer == customer) && > >> (article == null || ddt.Article == article)) > >> .OrderBy(ddt => ddt.Ddt.Dateddt).ToList(); > > >> The problem is "ddt.IsClose() == false" because it generates the > >> following Sql statement (fragment): > > >> .....WHERE (((not ((this_.NotReadyToUse = @p0)) and not (1=1)) > >> and ......etc. etc. > > >> As you can see it generates "and not (1=1)" that is always false and > >> therefore the query doesn't return any rows. More the function IsClose > >> () id never executed. > > >> My question is: Can I use methods inside the Where, if yes, what is > >> wrong in my Where clause. > > >> Thanks, > >> Alessandro Cavalieri --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com.ar/group/nhcdevs?hl=en -~----------~----~----~----~------~----~------~--~---
