开发者

How do I map class like Types<Type> in NHibernate?

I have a need for specialize collection of custom typ开发者_Python百科es in my Domain Model.

public class Foos : List<Foo>
{

}

Is there a way to map this object in NHibernate and how could I use FluentNHibernate to do this as well ?


NHibernates requires all collections to be mapped as ISomething to facilitate lazy loading. Therefore,

private IList<Foo> foos;

// This is a property that has to be mapped
protected IList<Foo> _Foos
{ 
    get { return foos; } 
    set { foos = value; } 
}

public Foos Foos
{
    get { return new Foos(_Foos); }
}

Don't know though how to map this with Fluent NHibernate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜