From: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 15:43:58
|
[ http://216.121.112.228/browse/NH-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21060#action_21060 ] Andrei Alecu commented on NH-2691: ---------------------------------- SQLite only has INTEGER, which can be up to 64 bits, so the cast is correct here for the SQLite dialect. What seems wrong is the order clause though. You might want to check if the cast is correct for some other dialect that treats has separate types for 64 bit integers. (maybe SQL Express) > Linq LongCount() behavior different from Count() > ------------------------------------------------ > > Key: NH-2691 > URL: http://216.121.112.228/browse/NH-2691 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Minor > > It seems to me that Count() and LongCount() should behave the same, except for the max value they return. I am finding this not to be the case. Consider the following example: > var query = > from cat in session.Query<Cat>() > orderby cat.Born > select cat; > var queryCount = query.Count(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ > var queryLongCount = query.LongCount(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ order by cat0_.Born > I am partial to the behavior of .Count() where it ignores the order. Also, it seems that LongCount() should probably cast as a long, instead of an int. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |