Hi all,

(cross-posting from 
http://stackoverflow.com/questions/29969237/mapping-a-component-inside-a-component-collection
)

I'm trying to map a value object collection where these contain other value 
objects but am getting the below exception.

Was trying to put Access.Field in play but can't seem to figure out where 
to set that up for nested components...

Any help will be much appreciated.

Thanks in advance.

*nHibernate Exception:*

 ----> NHibernate.PropertyNotFoundException : Could not find a getter for 
property '_timeAtAddress' in class 'CustomerAddress'

*Domain:*

public class CustomerAddress{
    private TimePeriod _timeAtAddress;

    protected CustomerAddress() { }

    public CustomerAddress(TimePeriod timeAtAddress)
    {
        _timeAtAddress = timeAtAddress;
    }

    public TimePeriod TimeAtAddress { get { return _timeAtAddress; } }}
public class TimePeriod{
    private readonly int _months;
    private readonly int _years;

    protected TimePeriod() { }

    public TimePeriod(int months, int years)
    {
        _months = months;
        _years = years;
    }

    public int Months { get { return _months; } }
    public int Years { get { return _years; } }}

*nHibernate Mapping:*

contact.HasMany<CustomerAddress>(Reveal.Member<Contact>("_customerAddresses"))
    .Schema(...)
    .Table(...)
    .KeyColumn(...)
    .AsBag()
    .Not.LazyLoad()
    .Component(address =>
    {
        .
        .
        .

        address.Component(Reveal.Member<CustomerAddress, 
TimePeriod>("_timeAtAddress"), timeAtAddress =>
        {
            
timeAtAddress.Map(Reveal.Member<TimePeriod>("_years")).Column("TIME_YEARS");
            
timeAtAddress.Map(Reveal.Member<TimePeriod>("_months")).Column("TIME_MONTHS");
        });
    });

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to