开发者

nhibernate activerecord linq Contains problem

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 {"I开发者_JS百科ndex 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!


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...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜