How can I map this:
public class Customer
{
private IList _orders;
public IEnumerable
GetAllOrders()
{
return _o
The easiest solution is to expose your collection as a public property Orders instead of the GetAllOrders() method. Then your mapping is
HasMany(x => x.Orders)
.Access.AsCamelCaseField(Prefix.Underscore);
and your class is
public class Customer
{
private IList _orders = new List();
public IEnumerable Orders
{
get { return _orders; }
}
}
If that doesn't work for you, it is possible to map private properties using Fluent NHibernate's Reveal mapping.
Edited to add: Having just done this, the correct answer is:
HasMany(Reveal.Property("_orders")) etc.
The collection must be exposed as a protected virtual property to allow proxying:
protected virtual IList _orders { get; set; }
This answer put me on the right track.