Import should be pretty straightforward. It would look something like this:
class LookupDTOMap : ClassMap<LookupDTO>
{
public LookupDTOMap()
{
ImportType<LookupDTO>().As("AliasedLookupDTO");
}
}
I am curious though as to why you don't have a "rename" attribute on your
original hbm mapping.
On Fri, Apr 3, 2009 at 11:49 PM, Matthew <[email protected]>wrote:
>
> Hi,
>
> I'm currently using an hbm.xml with an <import> tag as follows:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="My.Assembly.Name"
> namespace="My.Namespace.Name">
> <import class="My.Namespace..Name.LookupDTO, My.Assembly.Name" />
> </hibernate-mapping>
>
> which i use as follows:
>
> using (ISession session = NHibernateHelper.OpenSession())
> {
> return session.CreateQuery(
> "select new LookupDTO(c.ClientCode, c.ClientName) from Client c
> order
> by c.ClientName")
> .List<LookupDTO>();
> }
>
> I'm trying to switch to Fluent NHibernate but can't figure out how to
> do this part.
>
> I've read through the following related post but can't figure out,
> syntactically, how to use the ImportType<T> method to do the
> necessary:
>
>
> http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/47f2d046fb3a8435/c6905735945e22bb?hl=en&lnk=gst&q=importtype%3CT%3E#c6905735945e22bb
>
> If i try
>
> class LookupDTOMap : ClassMap<LookupDTO>
> {
> public LookupDTOMap()
> {
> Map(x => x.[intellisense options]
> }
> }
>
> then ImportType<T> is not an available method.
>
> Any ideas?
>
> Thanks
>
> Matthew
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---