小编J F*_*des的帖子

映射组件集合中的组件

我正在尝试映射一个值对象集合,其中包含其他值对象,但我得到以下异常.

nHibernate异常:

 ----> NHibernate.PropertyNotFoundException : Could not find a getter for property '_timeAtAddress' in class 'CustomerAddress'
Run Code Online (Sandbox Code Playgroud)

域:

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 { …
Run Code Online (Sandbox Code Playgroud)

nhibernate domain-driven-design fluent-nhibernate

11
推荐指数
1
解决办法
337
查看次数