I'm not sure NhLambdaExtensions will completely eradicate the problem (I think 
you could still use a type-safe alias that is simply using incorrect path).

Wouldn't hurt to have a JIRA?
  From: Fabio Maulo 
  Sent: Friday, March 06, 2009 4:21 AM
  To: [email protected] 
  Subject: [nhusers] Re: SetFetchMode allows non-existent property


  Your problem will be resolved with NH3.0.0 (thanks to Richard Brown) 
  
http://nhforge.org/blogs/nhibernate/archive/2009/01/07/typesafe-icriteria-using-lambda-expressions.aspx


  2009/3/6 Germán Schuager <[email protected]>

    Thanks, I've tested it and you are right.

    However, I think that it should be possible for NH to determine whether a 
given association path is used to build a "select" statement or not.
    Developers: Could this be done? (Does the internals of NH allow this?)

    I don't think that NH should just swallow a typing error silently without 
telling me about it at runtime.

    Regards. 



    On Thu, Mar 5, 2009 at 8:44 PM, Roger Kratz <[email protected]> 
wrote:


      I was wondering the same question a while ago.

      IIRC, the reason why an exception isn't thrown in this case is nh's 
ability for polymorphistic queries. In your case, it does not have to be a Cat 
you get back but a DomesticCat or whatever.
      In other words - just because your prop doesn't exist in the type you 
create the criteria for, it can exists in sub types.


      ________________________________
      Från: [email protected] [[email protected]] för Germán 
Schuager [[email protected]]
      Skickat: den 5 mars 2009 22:46
      Till: [email protected]
      Ämne: [nhusers] SetFetchMode allows non-existent property


      Hi, given this code:

      session.CreateCriteria(typeof (Cat))
         .SetFetchMode("nonExistentAssociation", FetchMode.Eager)
         .List<Cat>();

      where the class Cat doesn't have any property named 
nonExistentAssociation, I was expecting that NH throws an exception pointing 
that "nonExistentAssociation" is not a valid association path, but it does not. 
Is this ok?













  -- 
  Fabio Maulo


  

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