nhibernate activerecord linq Contains problem

Posted by Robert Ivanc on Stack Overflow See other posts from Stack Overflow or by Robert Ivanc
Published on 2010-03-26T18:09:20Z Indexed on 2010/03/26 18:13 UTC
Read the original article Hit count: 778

Filed under:
|
|
|

Hi,

I am having problems with the following query in Castle ActiveRecord 2.12:

var q = from o in SodisceFMClientVAR.Queryable
        where taxnos2.Contains(o.TaxFileNo)
        select o;

taxNos2 is an array of strings.

When run I get an exception: + InnerException {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"} System.Exception {System.ArgumentOutOfRangeException}

    StackTrace  "   at Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery query)\r\n   at Castle.ActiveRecord.Linq.LinqResultWrapper`1.Populate()\r\n   at Castle.ActiveRecord.Linq.LinqResultWrapper`1.GetEnumerator()\r\n   at NHibernate.Linq.Query`1.GetEnumerator()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n   at prosoft.skb.insolventnostDataAccess.InsolventnostDataAccAR.GetOurUsersListLS(ICollection`1 taxNos) in C:\\svn\\skb\\insolventnostWithAR\\prosoft.skb.insolventnostDataAccess\\InsolventnostDataAR.cs:line 214\r\n   at prosoft.skb.insolventnostDataFromWS.InsolventnostFromWS.filterByOurUsers(IEnumerable`1 odprtiPostopki) in C:\\svn\\skb\\insolventnostWithAR\\prosoft.skb.insolventnostDataFromWS\\InsolventnostFromWS.cs:line 237\r\n   at prosoft.skb.insolventnostDataFromWS.InsolventnostFromWS.SyncData() in C:\\svn\\skb\\insolventnostWithAR\\prosoft.skb.insolventnostDataFromWS\\InsolventnostFromWS.cs:line 53"    string

Does Contains even work in linq for nhibernate? I couldn't find anything via google... Is there a workaround?

Thanks!

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about nhibernate