you should use the substitution from configuration file to avoid this kind
of situation.you cannot do any filter from this properties, because
NHibernate is filling the query's parameter to the enumaration value.
if you look at the sql generated.. you'll see this.


Plácido Bisneto


2009/6/12 CassioT <[email protected]>

>
> Hi again.
>
> The application that I work today has to access the database from an
> older application. The database schema of this older application has
> some fields that act like a flags.
>
> Status char(2) - "NA": Not Available, "A": Available, "PA" Partially
> Available....
>
> I don't like to use them as they are in my app, so what I do is:
>
> 1) Create an Enumerator - StatusEnumerator
> 2) Map the database field status as string - access="field", private
> string status (class)
> 3) Create a Property StatusEnumerator Status
>
> In step 3, what I do:
>
> public StatusEnumerator Status
> {
>    get
>    {
>         if(status == "NA")
>             return StatusEnumerator.NotAvailable;
>             //...
>    }
>
>    set
>    {
>         if(value == StatusEnumerator.NotAvailable)
>             status = "NA";
>         //...
>    }
> }
>
>
> I already did it some times, it works, but now I found that NH do not
> let me filter by these kind of properties.
>
> I thought that NH would know that I'm accessing by field and
> everything would be ok.
>
> What I am doing is wrong, is there  a better way of doing or NH can't
> handle this and it's not recommended?
>
> Thank you
> >
>

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