It comes from the fact that the old Linq provider (which has been completely replaced), just mapped the Linq query to an ICriteria query,
A >= B becomes Restrictions.Ge(A,B) which is converted to A.Property1 >= B.Property1 AND A.Property2 >= B.Property2 AND A.Property3 >= B.Property3 AND ..... You will have to rewrite your queries to explicitly query on both properties. Either manually or by using an ExpressionVisitor. /G 2016-04-18 16:10 GMT+02:00 Erik H <[email protected]>: > Okay, it might not be correct.... but where does the GE or LT comes > from...? Any ideas? > > > On Monday, April 18, 2016 at 3:31:26 PM UTC+2, Oskar Berggren wrote: > >> >> >> 2016-04-18 12:41 GMT+01:00 Erik H <[email protected]>: >> >>> >>> public static bool operator >=(JaarEnMaand jaarEnMaand1, >>>> JaarEnMaand jaarEnMaand2) >>>> { >>>> if (jaarEnMaand1.Jaar == jaarEnMaand2.Jaar) >>>> { >>>> return (jaarEnMaand1.Maand >= jaarEnMaand2.Maand); >>>> } >>>> return (jaarEnMaand1.Jaar >= jaarEnMaand2.Jaar); >>>> } >>>> >>>> >> >>> >>> *Model:* >>> >>>> public class AsapInput : Entity{ >>> >>> public virtual JaarEnMaand AsapVerwerkingsPeriode { get; set; } >>>> } >>>> >>> >>> >>> *LINQ statement:* >>> >>>> .Where(ai => ai.AsapVerwerkingsPeriode >= >>>> periodeVanaf && ai.AsapVerwerkingsPeriode <= periodeTm && ( //niet >>>> geblokkeerde beschikbaarstellingen en premie inhoudingen >>>> (ai.Type == AsapInputType.Beschikbaarstelling >>>> || ai.Type == AsapInputType.BrutoPremieInhouding || ai.Type == >>>> AsapInputType.NettoPremieInhouding) && >>>> ai.Uitkeringscomponent.Bron != >>>> UitkeringscomponentBron.HandmatigplanUC)); >>> >>> >>> >>> .Where(ai => ai.Uitkeringsplan.Contractnummer == >>>> contract || ai.Uitkeringsplan.Contractnummer == contract.PadLeft(20, '0')) >>> >>> >>> >> >>> >>> *CORRECT* Generated SQL where statment in *NHibernate 2.1.2.400*: >>> >>>> WHERE (( >>>> >>>> this_.asapverwerkingsperiodemaand >= @p0 >>>> AND >>>> this_.asapverwerkingsperiodejaar >= @p1 >>>> >>> >> >> But this is NOT correct! At least it doesn't match your C# implementation >> for arbitrary values of periods: >> C# 2005-06 >= 2004-07 => ((2005==2004 AND 06>=07)) OR (2005>=2004) => >> TRUE >> SQL 2005-06 >= 2004-07 => (2005>=2004 AND 06>=07) => FALSE >> >> >> /Oskar >> >> >> >> -- > 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 https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
