Projections and Imports in Active Record

time to read 2 min | 243 words

Ken Egozi talks about Projections and Imports in Active Record and he asks a couple of questions about it.

  • Imports attribute poorly named:
    The Imports attribute is used to let NHibernate knows that it should recognize this class with a different name. Considerring the Java heritage of NHibernate, it is not surprising that it is using "import" to do this. In may be better if you could think about it as the eqiulent of:
    using renamed=FullClassName; 
    Since this is exactly what it does.
  • Lack of default name / name of the attribute:
    Again, if you consider the above syntax, it should be obvious why this is so. The imports attribute is mainly intended to be used to avoid name coliisions. Bringing it to the fold so HQL will recognize it is a side benefit.

Anyway, patches are always welcome... :-)