How does Fluent NHibernate support the Import Entity

Posted by Bender on Stack Overflow See other posts from Stack Overflow or by Bender
Published on 2010-04-12T15:29:04Z Indexed on 2010/04/12 15:33 UTC
Read the original article Hit count: 389

I want to create a strongly type object from a fluent NHibernate query. If I were using HQL and NHibernate I belive I would need:

the class for the output

Namespace Model
    Public Class namecount
        Public Overridable Property lastname() as string ...
        Public Overridable Property lastnamecount() as integer ...
        Public Sub New(lastname as string, count as integer) ...
    End Class
End Namespace

an .hbm.xml file

<?xml ...>
<hibernate-mapping ...>
  <import class="model.namecount,model"> 
</hibernate-mapping>

and of course the query

_session.createquery("select new namecount(lastname, count(lastname)) ...")

(The above is a paraphrased example taken from one of the 2008 SummerofNHibernate videos)

I cannot find any examples of how to do this with fluent (even in C#), is it possible? If it isn't is there a VB example of how to mix Fluent and .hbm.xml

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about vb.net