Ok ic the benefits. Also regarding fnh. Nevertheless it is not easy to explain the difference to someone new to nhibernate. I'll give it a try on the next opportunity.
-Tom On 12 aug, 17:44, Fabio Maulo <[email protected]> wrote: > Now that you saw something more about ConfORM I will happy if you can answer > my annoying question. > Can you show me the equivalent-mapping/procedure using what ever you want ? > > Thanks. > > > > > > On Thu, Aug 12, 2010 at 12:34 PM, Fabio Maulo <[email protected]> wrote: > > On Thu, Aug 12, 2010 at 11:43 AM, Tom Allard <[email protected]> wrote: > > >> "Make everything as simple as possible, but not simpler." > >> -- Albert Einstein > > > Sure. > > For that reason this ConfORM mapping > > > var orm = new ObjectRelationalMapper(); > > > orm.TablePerClass<Animal>(); > > > orm.TablePerClass<User>(); > > orm.TablePerClass<StateProvince>(); > > orm.TablePerClassHierarchy<Zoo>(); > > > orm.ManyToMany<Human, Human>(); > > orm.OneToOne<User, Human>(); > > > orm.PoidStrategies.Add(new NativePoidPattern()); > > > is equivalent to this XML mapping > > > <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > > namespace="ConfOrmExample.Domain" > > assembly="ConfOrmExample" > > > xmlns="urn:nhibernate-mapping-2.2"> > > <class name="User"> > > > <id name="Id" type="Int64"> > > > <generator class="native" /> > > > </id> > > <property name="UserName" /> > > > <one-to-one name="Human" /> > > > <list name="Permissions"> > > > <key column="user_key" /> > > > <list-index /> > > <element type="String" /> > > > </list> > > </class> > > <class name="Animal"> > > > <id name="Id" type="Int64"> > > > <generator class="native" /> > > > </id> > > <property name="BodyWeight" /> > > > <set name="Offspring" inverse="true" cascade="all,delete-orphan"> > > > <key column="Mother" /> > > > <one-to-many class="Animal" /> > > > </set> > > <many-to-one name="Mother" cascade="all" /> > > > <many-to-one name="Father" cascade="all" /> > > > <property name="Description" /> > > > <many-to-one name="Zoo" /> > > > <property name="SerialNumber" /> > > > </class> > > <class name="StateProvince"> > > > <id name="Id" type="Int64"> > > > <generator class="native" /> > > > </id> > > <property name="Name" /> > > > <property name="IsoCode" /> > > > </class> > > <class name="Zoo"> > > > <id name="Id" type="Int64"> > > > <generator class="native" /> > > > </id> > > <discriminator /> > > <property name="Name" /> > > > <property name="Classification" /> > > > <map name="Animals" inverse="true"> > > > <key column="Zoo" /> > > > <map-key type="String" /> > > > <one-to-many class="Animal" /> > > > </map> > > <map name="Mammals" inverse="true"> > > > <key column="Zoo" /> > > > <map-key type="String" /> > > > <one-to-many class="Mammal" /> > > > </map> > > <component class="Address" name="Address"> > > > <property name="Street" /> > > > <property name="City" /> > > > <property name="PostalCode" /> > > > <property name="Country" /> > > > <many-to-one name="StateProvince" /> > > > </component> > > </class> > > <joined-subclass name="Mammal" extends="Animal"> > > > <key column="animal_key" /> > > > <property name="Pregnant" /> > > > <property name="Birthdate" /> > > > </joined-subclass> > > <joined-subclass name="DomesticAnimal" extends="Mammal"> > > > <key column="mammal_key" /> > > > <many-to-one name="Owner" cascade="all" /> > > > </joined-subclass> > > <joined-subclass name="Cat" extends="DomesticAnimal"> > > > <key column="domesticanimal_key" /> > > > </joined-subclass> > > <joined-subclass name="Dog" extends="DomesticAnimal"> > > > <key column="domesticanimal_key" /> > > > </joined-subclass> > > <joined-subclass name="Reptile" extends="Animal"> > > > <key column="animal_key" /> > > > <property name="BodyTemperature" /> > > > </joined-subclass> > > <joined-subclass name="Lizard" extends="Reptile"> > > > <key column="reptile_key" /> > > > </joined-subclass> > > <subclass name="PettingZoo" extends="Zoo" /> > > > <joined-subclass name="Human" extends="Mammal"> > > > <key column="mammal_key" /> > > > <component class="Name" name="Name"> > > > <property name="First" /> > > > <property name="Initial" /> > > > <property name="Last" /> > > > </component> > > <property name="NickName" /> > > > <bag name="Friends" cascade="all,delete-orphan"> > > > <key column="human_key" /> > > > <many-to-many class="Human" /> > > > </bag> > > <bag name="Pets" inverse="true" cascade="all,delete-orphan"> > > > <key column="Owner" /> > > > <one-to-many class="DomesticAnimal" /> > > > </bag> > > <map name="Family" cascade="all,delete-orphan"> > > > <key column="human_key" /> > > > <map-key type="String" /> > > > <many-to-many class="Human" /> > > > </map> > > <property name="Height" /> > > > <property name="BigIntegerValue" /> > > > <property name="BigDecimalValue" /> > > > <property name="IntValue" /> > > > <property name="FloatValue" /> > > > <set name="NickNames"> > > > <key column="human_key" /> > > > <element type="String" /> > > > </set> > > <map name="Addresses"> > > > <key column="human_key" /> > > > <map-key type="String" /> > > > <composite-element class="Address"> > > > <property name="Street" /> > > > <property name="City" /> > > > <property name="PostalCode" /> > > > <property name="Country" /> > > > <many-to-one name="StateProvince" /> > > > </composite-element> > > </map> > > > </joined-subclass> > > > </hibernate-mapping> > > > Who wrote the XML mapping ? > > > -- > > Fabio Maulo > > -- > Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
