Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-20 Thread Gunnar Liljas
For rewriting, try this: https://gist.github.com/gliljas/c638d339bce6d48840d3db09cbf2cbac You will have to replace all calls to Session.Query with Session.GetQuery (or whatever you want to call it). Maybe you have already created such an extension to redirect Session.Linq to Session.Query

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-19 Thread Oskar Berggren
2016-04-19 9:52 GMT+01:00 Erik H : > So I just did a test... > > An equals operator in the where statement *does* work! > > .Where(ai => ai.AsapVerwerkingsPeriode* == *periodeVanaf >> && ai.AsapVerwerkingsPeriode* == *periodeTm && ( //niet geblokkeerde

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-19 Thread Gunnar Liljas
The equals operator works because that's the only case which can be supported. It applies equality check to all properties. >= is translated to Ge because that's what Ge means. *G*reather than or *e*qual to. It is not possible to support your operator overload, since that would require that

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-19 Thread Erik H
So I just did a test... An equals operator in the where statement *does* work! .Where(ai => ai.AsapVerwerkingsPeriode* == *periodeVanaf > && ai.AsapVerwerkingsPeriode* == *periodeTm && ( //niet geblokkeerde > beschikbaarstellingen en premie inhoudingen >

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-19 Thread Erik H
Thanks's all for responding! In the autoMappingExpressions I do state it's a component type: autoMappingExpressions.IsComponentType = type => (type == typeof (YearAndMonth)); Rewriting the queries is the last resort in my humble opinion... I've googled a bit regarding ExpressionVisitor but

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Gunnar Liljas
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

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Erik H
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 : > >> >> public static bool operator >=(JaarEnMaand jaarEnMaand1,

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Oskar Berggren
2016-04-18 12:41 GMT+01:00 Erik H : > > public static bool operator >=(JaarEnMaand jaarEnMaand1, >> JaarEnMaand jaarEnMaand2) >> { >> if (jaarEnMaand1.Jaar == jaarEnMaand2.Jaar) >> { >> return (jaarEnMaand1.Maand >=

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Erik H
This code wasn't changed. It's in Dutch, JaarEnMaand means YearAndMonth from my previous snippets... Model, LINQ and generated where statement is below C# code using System; > using System.Globalization; > namespace Model > { > /// > /// Een combinatie van een jaar en een maand. >

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Oskar Berggren
Can you show an operator (with generated SQL) that was correct in 2.1 and wrong in 4.0? /Oskar 2016-04-18 11:06 GMT+01:00 Erik H : > Thanks for the quick reply! > > Good spot regarding > operator, but there are several operators > implemented, I didn't put them all in

Re: [nhusers] NHibernate translates >= into GE and throws GenericADOException on object with custom operators

2016-04-18 Thread Erik H
Thanks for the quick reply! Good spot regarding > operator, but there are several operators implemented, I didn't put them all in this post. Implemented operators: ==, !=, >, >=, <, <=, +, - Are there any options you see that I can do to get it back working? On Monday, April 18, 2016 at