Late to chirp in but this is good resource for mapping by code syntax...
http://notherdev.blogspot.co.uk/2012/02/nhibernates-mapping-by-code-summary. html Rippo From: [email protected] [mailto:[email protected]] On Behalf Of Sean Farrow Sent: 13 August 2013 14:29 To: [email protected] Subject: RE: [nhusers] converting a mapping from xml to mapping by code Hi Pete, Worked a treat! Thanks. Sean. From: [email protected] [mailto:[email protected]] On Behalf Of Pete Appleton Sent: 13 August 2013 13:53 To: [email protected] Subject: RE: [nhusers] converting a mapping from xml to mapping by code Untested, but something like the following should do the trick: public class ExtractedPersonDataMapping : ClassMapping<ExtractedPersonData> { public ExtractedPersonData() { ComposedId(id => { id.ManyToOne(epd => epd.Type); id.Property(epd => epd.ExtractedPersonDataID); }); Property(epd => epd.Forename); Property(epd => epd.Surname); Property(epd => epd.Forename, m => m.NotNullable(true)); } } /Pete From: [email protected] [mailto:[email protected]] On Behalf Of Sean Farrow Sent: 13 August 2013 12:07 To: '[email protected]' Subject: [nhusers] converting a mapping from xml to mapping by code Hi all, I've got the following mapping in hbm.xml. How would I convert this to using the mapping by code syntax? Any help appreciated. Regards Sean. <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="SalamanderSoft.OnlineReporting.Core" namespace="SalamanderSoft.OnlineReporting.Core.Domain.CachedDataMapper"> <class name="ExtractedPersonData"> <composite-id> <key-many-to-one name="Type"/> <key-property name="ExtractedPersonDataID"/> </composite-id> <property name ="Forename"/> <property name ="Surname"/> <property name ="Data" not-null="true"/> </class> </hibernate-mapping> -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
