.NET 4 ISet HashSet 可以替换 NHibernate Iesi.Collections ISet 、 HashSet 吗?我正在使用 Castle 代理和 NHibernate 3.0 。
是的。有两种方法:
- 将您的收藏声明为
ICollection<T>
并将其初始化为HashSet<T>
. See 本文 http://ayende.com/blog/3971/nhibernate-tidbit-using-set-without-referencing-iesi-collections。我将收藏建模为私有
成员并曝光IEnumerable<T>
所以这很有效,但缺点是你不能暴露ISet<T>
.
- 使用 Jose Romaniello 的 Set4Net4 NuGet 包。看本文 http://nhforge.org/blogs/nhibernate/archive/2011/03/15/using-lt-set-gt-in-mappings-without-iesi-collections-net-4.aspx和源代码 https://bitbucket.org/jfromaniello/nhibernate.setfornet4.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)