> Tom, perhaps Brand "does not need to learn how map with XML"but for sure he
> must learn "how map with FNH's auto-map".
> I'm curious to see this example using FNH auto-map.
Automapping should work in this case if you:
- add an Id member to the classes you wish to automap
- make all member properties virtual
- change the list to an ILIst
For example:
public class ClientOrder
{
public virtual int Id { get; private set; }
public virtual int ClientOrderId { get; set; }
public virtual Client Client { get; set; }
public virtual DateTime OrderDate { get; set; }
public virtual Party Party { get; set; }
public virtual IList<ClientOrderProduct> OrderProducts { get;
set; }
}
public class ClientOrderProduct
{
public virtual int Id { get; private set; }
public virtual Product Product { get; set; }
public virtual int OrderAmount { get; set; }
public virtual decimal Price { get; set; }
}
You would also have to tell the automapper what classes to map when
you create your session - see the FNH wiki for examples - search for
GetAutoPersistenceModel. This is typically a couple of lines in some
boilerplate functions which you set up once, and expand as your object
model grows.
--
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.