本文介绍了是Iesi.Collections.Generic.LinkedHashSet< T> Iesi.Collections.Generic.ISet< T>的最佳替代方案。同时迁移到NHibernate 4.0.3.4000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我用最新版本4.0.3.4000升级了我的NHibernate库。之后 - 在编译期间,我遇到了与Iesi.Collections.Generic.ISet相关的问题。从细节我明白 - 这个接口被删除,备用选项可用 - 其中之一是LinkedHashSet。



我想知道 - 这是替代ISet的最佳替代品吗?

/ div>

这来自:

因此,我们现在可以使用接口

  System.Collections.Generic.ISet< T> 

并且作为它的实现甚至包含 System 在类型中,例如

  System.Collections.Generic.HashSet< T> 

因此减少对 iesi 库的依赖... ...



但正如这里所讨论的:。项目:

 使用System.Collections.Generic; 
使用System.Collections.ObjectModel;

命名空间NHibernate.DomainModel.Northwind.Entities
{
公共类客户
{
私有只读ISet< Order> _命令;

public Customer()
{
_orders = new System.Collections.Generic.HashSet< Order>();
}
公共虚拟ISet< Order>订单
{
get {return _orders; }
}
...


Recently I have upgraded my NHibernate library with latest version 4.0.3.4000. After that - during compilation I faced an issue related to "Iesi.Collections.Generic.ISet". From details I understand that - this interface is dropped off and alternate options are available - one of it is LinkedHashSet.

I would like to know that - is this the best alternate to replace ISet?

解决方案

This is from release notes:

So we can now use interface

System.Collections.Generic.ISet<T>

and as its implementation even the System built in types, e.g.

System.Collections.Generic.HashSet<T>

And therefore reduce dependency on iesi library...

But as discussed here: What is a suitable NHibernate / Iesi.Collections.Generic.ISet<T> replacement? - we can also use the LinkedHashSet<T>, ReadOnlySet<T>, SychronizedSet<T>

Also check the Customer.cs in NHibernate test project:

using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace NHibernate.DomainModel.Northwind.Entities
{
    public class Customer
    {
        private readonly ISet<Order> _orders;

        public Customer()
        {
            _orders = new System.Collections.Generic.HashSet<Order>();
        }
        public virtual ISet<Order> Orders
        {
            get { return _orders; }
        }
        ...

这篇关于是Iesi.Collections.Generic.LinkedHashSet&lt; T&gt; Iesi.Collections.Generic.ISet&lt; T&gt;的最佳替代方案。同时迁移到NHibernate 4.0.3.4000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 00:32