开发者

Unable to cast PersistentGenericBag to ISet exception

I am getting this exception:

Unable to cast开发者_Go百科 object of type 'NHibernate.Collection.Generic.PersistentGenericBag`1[System.Int64]' to type 'System.Collections.Generic.ISet`1[System.Int64]'

I use:

public virtual ISet<long> Ids { get; set; }

I am not doing any explicit mapping here using FNH.


If you map your collection as Bag you should use IList<T> in your entity for collection.

If you map as Set then you either can use ISet<T> from Iesi.Collections or ICollection<T> interface from .NET


NHibernate does not support NET4 ISet out of the box. You need to add this package.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜