since you're doing bitwise comparison, the proper way to doing that is
(myObject.TestEnum1 & ETest.Test1) == ETest.Test1.  I don't know if this
would be property translated or not though.

On Tue, May 25, 2010 at 4:18 PM, olaf <[email protected]> wrote:

> Hi,
>
> I've defined an enum like this:
>
> namespace Test
> {
>        [System.FlagsAttribute]
>        public enum ETest
>        {
>                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
> other flag.
>
> 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.
>
>


-- 
thanks

cliff

-- 
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.

Reply via email to