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 " atCastle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery
query)\r\n at
Castle.ActiveRecord.Linq.LinqResultWrapper1.Populate()\r\n1.GetEnumerator()\r\n
at
Castle.ActiveRecord.Linq.LinqResultWrapper
at
NHibernate.Linq.Query1.GetEnumerator()\r\n1..ctor(IEnumerable
at
System.Linq.Buffer11
source)\r\n at
System.Linq.Enumerable.ToArray[TSource](IEnumerable
source)\r\n at
prosoft.skb.insolventnostDataAccess.InsolventnostDataAccAR.GetOurUsersListLS(ICollection11
taxNos) in
C:\\svn\\skb\\insolventnostWithAR\\prosoft.skb.insolventnostDataAccess\\InsolventnostDataAR.cs:line
214\r\n at
prosoft.skb.insolventnostDataFromWS.InsolventnostFromWS.filterByOurUsers(IEnumerable
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!
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…