views:

287

answers:

1

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.LinqResultWrapper1.Populate()\r\n at Castle.ActiveRecord.Linq.LinqResultWrapper1.GetEnumerator()\r\n at NHibernate.Linq.Query1.GetEnumerator()\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at prosoft.skb.insolventnostDataAccess.InsolventnostDataAccAR.GetOurUsersListLS(ICollection1 taxNos) in C:\\svn\\skb\\insolventnostWithAR\\prosoft.skb.insolventnostDataAccess\\InsolventnostDataAR.cs:line 214\r\n at prosoft.skb.insolventnostDataFromWS.InsolventnostFromWS.filterByOurUsers(IEnumerable1 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!

+1  A: 

Well, I figured it out - the problem was actually in the class mapping to the table, DateTime fields needed to be DateTime ? fields.

Weird error though...

Robert Ivanc