Can .NET 4 ISet<> HashSet<> replace NHibernate Iesi.Collections ISet , HashSet?

后端 未结 3 1769
清酒与你
清酒与你 2021-02-07 01:28

Can .NET 4 ISet<> HashSet<> replace NHibernate Iesi.Collections ISet , HashSet ? I am using Castle proxy, and NHibernate 3.0 .

3条回答
  •  误落风尘
    2021-02-07 02:04

    Yes. There are two approaches:

    1. Declare your collection as ICollection and initialize it as HashSet. See this article. I model collections as private members and expose IEnumerable so this works well, but the downside is that you can't expose ISet.
    2. Use Jose Romaniello's Set4Net4 NuGet package. See this article and the source code.

提交回复
热议问题