views:

177

answers:

0

Is it possible to reuse a component mapping in a projection?

Here is the mapping for the Vendor entity:

   <class name="Vendor" table="vendor">
     ...
     <property name="Name" column="Name" />
     <component name="Address" class="MyProject.Address, MyAssembly" >
       <property name="Street" column="street" />
       <property name="City" column="City" />
     </component>
   </class>

For a report I'd like to retrieve these vendors in a data transfer object but reuse the Address component (because there are many fields and some useful formatting behavour).

public class VendorDTO
{
    public string Name;
    public Address Address;

}

public class Address
{
    public string Street;
    public string City;
    public string SomeUsefulBehavour();
}

Is this possible without splitting Address out into it's own table?

Thanks!