Unable to cast object of type NHibernate.Collection.Generic.PersistentGenericBag to List

后端 未结 2 1697
暗喜
暗喜 2020-12-01 04:18

I have a class called ReportRequest as:

public class ReportRequest
{
    Int32 templateId;
    List entityIds;

    public virtual Int32? Id
            


        
相关标签:
2条回答
  • 2020-12-01 04:50

    Use collection interfaces instead of concrete collections, so NHibernate can inject it with its own collection implementation.

    In this case, use IList<int> instead of List<int>

    0 讨论(0)
  • 2020-12-01 04:50

    I found that using ICollection<T> worked where IList<T> did not.

    I'm no NHibernate wizard, but I did want to throw a bone to someone else who might land on this issue.

    0 讨论(0)
提交回复
热议问题