Hi, Is there a solution to this issue yet? I am using HQL for this at the moment but I would like to replace it with LINQ ?
As cliff suggested, I am trying to do something like this from obj in Session.Linq<MyEntity>() where ( obj.FlagsProperty & flag ) == ( flag ) select obj); where flag is the parameter but it is throwing following exception System.NullReferenceException : Object reference not set to an instance of an object. Any idea?? Awaiting Nabeel On May 28, 6:17 pm, olaf <[email protected]> wrote: > As far as I know is the new LINQ provider integrated into NHibernate > 3.0. So I can't use it with NH 2.1. > However, I will checkout NH 3.0 asap and report a bug if the behavior > is the same as in the old one. > > Olaf > > On 28 Mai, 11:52, Stefan Wenig <[email protected]> wrote: > > > I'd look into the new 3.0 LINQ provider, guess nobody's going to fix > > the old one. The new one seems to convert both boolean AND > > (ExpressionType.AndAlso) and bitwise AND (ExpressionType.And) into HQL > > BooleanAnd. I think that's a bug, if you can verify that just file an > > issue. Should be a piece of cake; since HQL supports the exact same > > syntax you'd want to write in LINQ (x &flag==flag), no further > > conversion should be required. Not sure though, I don't quite get that > > ANTLR stuff. > > > On 27 Mai, 08:59, olaf <[email protected]> wrote: > > > > Thanks, Unfortunately, HQL is not an option in my case. > > > > Olaf > > > > On 27 Mai, 02:05, Diego Mijelshon <[email protected]> wrote: > > > > > If you're open to HQL instead of > > > > Linq:http://stackoverflow.com/questions/2805661/how-to-query-flags-stored-... > > > > > Diego > > > > > On Tue, May 25, 2010 at 17:18, olaf <[email protected]> wrote: > > > > > Hi, > > > > > > I've defined anenumlike this: > > > > > > namespace Test > > > > > { > > > > > [System.FlagsAttribute] > > > > > publicenumETest > > > > > { > > > > > Test1 = 1, > > > > > Test2 = 2, > > > > > Test3 = 4 > > > > > } > > > > > > public class ETestStringType : > > > > > NHibernate.Type.EnumStringType<ETest> > > > > > { > > > > > } > > > > > } > > > > > > In my hbm file file I use it in a property: > > > > > > <property name="TestEnum1" > > > > > type="Test.ETestStringType, Test" > > > > > not-null="true" /> > > > > > > I can set the property with myObject.TestEnum1 = ETest.Test1 | > > > > > ETest.Test2. > > > > > > I use LINQ to quere the data: > > > > > > var result = from obj in session.Linq<MyType> where obj.TestEnum1 == > > > > > ETest.Test1 select obj; > > > > > > This returns all objects with TestEnum1 set to "ETest.Test1" but not > > > > > objects with TestEnum1 set to e.g. "ETest.Test1 | ETest.Test3" > > > > > > I need a way to get all objects set to ETest.Test1 combined with any > > > > > otherflag. > > > > > > Any ideas? > > > > > > Thanks > > > > > Olaf > > > > > > -- > > > > > 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]<nhusers%[email protected]> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/nhusers?hl=en.-ZitiertenTextausblenden - > > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > > - Zitierten Text anzeigen - > > -- 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.
