如何在Fluent NHibernate中映射受保护的集合? [英] How do I map a protected collection in Fluent NHibernate?
问题描述
编辑:
下面是我正在使用的代码,
HasMany< Trip>(x => Reveal.Property< Trip>(_ trips));
我也试过这段代码,
$ b $ (<_p $ p> HasMany< Trip>(Reveal.Property< Organization>(_ trips));
每次运行我的应用程序时,NHibernate都会说它不能映射到Property,或者抛出未知例外。假设组织有一个 IList < Trip>
(旅行)); >
代码应该可以工作。
检查它是一个属性,并且你有getter和setter的保护(私人将不起作用,因为NHibernate将代理集合进行lazyloading)。
I have tried using the Reveal property in Fluent but I can't get it to compile with a collection. I want one of my collections in an entity to be protected and not accessible anywhere except in the entity itself. Is this possible? Thanks
Edit:
Here's the code I'm trying to use,
HasMany<Trip>(x => Reveal.Property<Trip>("_trips"));
I've also tried this code as well,
HasMany<Trip>(Reveal.Property<Organization>("_trips"));
Everytime my app runs, NHibernate says it can't map to "Property" or it throws an unknown exception.
Assuming that Organization has a IList<Trip> the
HasMany<Trip>(Reveal.Property<Organization>("_trips"));
code should work. Check that it's a property and that you have protected getters and setters (privates will not work, since NHibernate will want to proxy the collection for lazyloading).
这篇关于如何在Fluent NHibernate中映射受保护的集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!