Anyone? Atm i've patched it with a quick and dirty find and replace
but that's far from ideal.

On 9 mrt, 12:44, "F.B. ten Kate" <[email protected]> wrote:
> I'm running into problems with this relatively easy task.
>
> We are setting up webservices that can get called with RequestOptions
> which allow for dynamic and generic setting of the DetachedCriteria
> properties (Adding criteria and Orderby's max results etc).
>
> So far this has been working great but atm i'm running into a problem
> with a Object that has nested alliases.
>
> We create base DetachedCriteria where the user's options are added to,
> meaning i have to setup aliases where needed.
>
> //Set the debtor criteria
>             DetachedCriteria criteria =
> DetachedCriteria.For(typeof(Invoice))
>                 .CreateAlias("Debtor", "Debtor")
>                 .CreateAlias("Reservation.Reason",
> "Reservation.Reason", JoinType.LeftOuterJoin)
>                 .Add(Expression.Eq("Debtor.Account.ID", accountID));
>
> The problem is the webservice users add orderby's based on the XML i
> give them, i reflect the actual propertynames back from the xml (for
> example: reservation.reservationreason.text would be reflected to
> Reservation.Reason.Text since those are my property names).
>
> Here in lies the problem, The orderby would be added with on the
> property: Reservation.Reason.Text which NHibernate cannot resolve....
>
> If i change the Alias
> into:                 .CreateAlias("Reservation.Reason",
> "ReservationReason", JoinType.LeftOuterJoin) and manually changing the
> orderby into ReservationReason.Text the code executes.
>
> I want my code to be as reusable as possible so i don't want to write
> exceptions in my code where i overwrite the reflection part and use
> static strings like "ReservationReason".
>
> Since it seems NHibernate does not like "dots" in the alias name the
> only other option in my eyes would be to determine if the class is a
> association (join, many-to-one etc) or just a component/property. If
> it's the First it should remove the "dots" from the reflected property
> name (this can be made reusable and automated) but if it's a component
> it should stay as it is since then NHibernate does understand the dots
> etc.
>
> Does anyone have any bright ideas or pushes in the right direction?
>
> (I didn't add my mappings since i dont think they are needed for this
> particular problem, if they are i will post them when requested.)

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