Unfortunately you can't (judging by the tests I've just written) but what you can do is
prop.VLTDays Is Nothing prop.VLTDays IsNot Nothing This is a workaround, but it would be better if the linq provider handled all the various scenarios rather than having to remember that only certain expressions will work without crashing On Dec 9, 4:28 pm, DanPlaskon <[email protected]> wrote: > James, > > I may be wrong; but can't you perform these queries with > prop.Equals(Nothing) and Not prop.Equals(Nothing) ? > > On Dec 9, 6:14 am, JamesSpibey <[email protected]> wrote: > > > Thanks for the reply, I grabbed the trunk version of relinq and > > rebuilt NHibernate (adding a handler for VBStringComparisonExpression) > > and that does seem to solve the = operator problem. However, there are > > also a couple issues with nullable types which I haven't been able to > > solve, for example > > > <TestMethod()> > > Public Sub > > NHibernate_Linq_Handles_Nullable_Fields_Using_Not_IsNothing() > > > Dim repo = ObjectFactory.GetInstance(Of IProductRepository)() > > > Using UnitOfWork.Start > > > Dim productCount = (From p In repo.GetProducts(Nothing) > > Where Not IsNothing(p.VLTDays)).Count > > > End Using > > > End Sub > > > <TestMethod()> > > Public Sub > > NHibernate_Linq_Handles_Nullable_Fields_Using_HasValue() > > > Dim repo = ObjectFactory.GetInstance(Of IProductRepository)() > > > Using UnitOfWork.Start > > > Dim productCount = (From p In repo.GetProducts(Nothing) > > Where p.VLTDays.HasValue).Count > > > End Using > > > End Sub > > > <TestMethod()> > > Public Sub > > NHibernate_Linq_Handles_Nullable_Fields_Using_Not_IsNothing() > > > Dim repo = ObjectFactory.GetInstance(Of IProductRepository)() > > > Using UnitOfWork.Start > > > Dim productCount = (From p In repo.GetProducts(Nothing) > > Where Not IsNothing(p.VLTDays)).Count > > > End Using > > > End Sub > > > <TestMethod()> > > Public Sub > > NHibernate_Linq_Handles_Nullable_Fields_Using_HasValue() > > > Dim repo = ObjectFactory.GetInstance(Of IProductRepository)() > > > Using UnitOfWork.Start > > > Dim productCount = (From p In repo.GetProducts(Nothing) > > Where p.VLTDays.HasValue).Count > > > End Using > > > End Sub > > > On Dec 8, 5:16 pm, sbohlen <[email protected]> wrote: > > > > I appears that some (if not quite all) of these issues are addressed > > > in a later release of the reLINQ provider (atop which much of NH's > > > LINQ support is based). We are looking into this and if it proves to > > > be the case its likely that NH 3.0.1 would probably include these > > > updates, addressing most of these VB.NET-related issues. > > > > In the mean time, if you want to expedite this process for your own > > > consumption, you can build the NH3 release code against the absolute > > > latest trunk build of reLINQ and see for yourself if this addresses > > > these issues. (BTW, if you do pursue this then it would be beneficial > > > if you report your results back to this thread). > > > > Regards, > > > > -Steve B. > > > > On Dec 6, 10:41 am, JamesSpibey <[email protected]> wrote: > > > > > Hi, > > > > > I've just download NHibernate 3 GA and was disappointed to find that > > > > the new NHibernate Linq provider has the same problems with VB.NET > > > > that the previous on did, mainly > > > > > - Handling of Nullable types (Neither IsNothing(x) or x.HasValue) work > > > > - Equality operator on strings (although we can get around this by > > > > using the Equals() method) > > > > > Moving to C# is not an option for us. Are there any plans to make the > > > > linq provider work with VB.NET?- Hide quoted text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" 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/group/nhusers?hl=en.
