This is my mapping
orm.TablePerClass<Client>();
orm.TablePerClass<Party>();
orm.TablePerClass<Product>();
orm.TablePerClass<ClientOrder>();
orm.Patterns.Poids.Add(new
ConfOrm.Shop.Patterns.PoidPropertyAsClassNameId());
To have this resut
<class name="ClientOrder">
<id name="ClientOrderId" type="Int32">
<generator class="hilo" />
</id>
<many-to-one name="Client" />
<property name="OrderDate" />
<many-to-one name="Party" />
<list name="OrderProducts">
<key column="clientorder_key" />
<list-index />
<composite-element class="ClientOrderProduct">
<many-to-one name="Product" />
<property name="OrderAmount" />
<property name="Price" />
</composite-element>
</list>
</class>
<class name="Client">
<id name="ClientId" type="Int32">
<generator class="hilo" />
</id>
</class>
<class name="Party">
<id name="PartyId" type="Int32">
<generator class="hilo" />
</id>
</class>
<class name="Product">
<id name="ProductId" type="Int32">
<generator class="hilo" />
</id>
</class>
Or this mapping
orm.TablePerClass<Client>();
orm.TablePerClass<Party>();
orm.TablePerClass<Product>();
orm.TablePerClass<ClientOrder>();
orm.Patterns.Poids.Add(new
ConfOrm.Shop.Patterns.PoidPropertyAsClassNameId());
orm.Patterns.PoidStrategies.Add(new IdentityPoidPattern());
with
var mapper = new Mapper(orm, new
ConfOrm.Shop.CoolNaming.CoolPatternsAppliersHolder(orm));
to obtain this XML mapping
<class name="ClientOrder">
<id name="ClientOrderId" type="Int32">
<generator class="identity" />
</id>
<many-to-one name="Client" column="ClientId" />
<property name="OrderDate" />
<many-to-one name="Party" column="PartyId" />
<list name="OrderProducts">
<key column="clientorder_key" />
<list-index />
<composite-element class="ClientOrderProduct">
<many-to-one name="Product" />
<property name="OrderAmount" />
<property name="Price" />
</composite-element>
</list>
</class>
<class name="Client">
<id name="ClientId" type="Int32">
<generator class="identity" />
</id>
</class>
<class name="Party">
<id name="PartyId" type="Int32">
<generator class="identity" />
</id>
</class>
<class name="Product">
<id name="ProductId" type="Int32">
<generator class="identity" />
</id>
</class>
2010/4/12 Tom Bushell <[email protected]>
>
>
> On Apr 12, 1:36 pm, Fabio Maulo <[email protected]> wrote:
> > Can I have a base entity with the Id
>
> Absolutely! Actually, that's the way most people do it - I just
> haven't gotten around to re-factoring my classes to inherit from an
> Entity base class yet.
>
> Id members can be int or GUID.
>
> > and the implementation of
> > Equals/GetHashCode ?
>
> Have not done this myself, but see no reason why not.
>
> -Tom
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
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.