Skip to:
I have a Ticket entity: public class Ticket{public virtual DateTime CreateDate { get; set; }public virtual DateTime? CloseDate { get; set; }}
Also I have a linq-to-NHibernte query for select average of (CloseDate - CreateDate) :
var average = SessionInstance.Query<Ticket>().Where(x => x.CloseDate != null) .Average(x => ((DateTime)x.CloseDate).Date.Ticks - x.CreateDate.Date.Ticks);
But above query has a runtime exception by this message :
Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [.Average[Domain.Model.Ticket](.Where[Domain.Model.Ticket](NHibernate.Linq.NhQueryable`1[Domain.Model.Ticket], Quote((x, ) => (DateTime.op_Inequality(x.CloseDate, NULLp1))), ), Quote((x, ) => (Subtract(Convert(x.CloseDate).Date.Ticks, x.CreateDate.Date.Ticks))), )]
Why?
this issue is duplicated by : https://nhibernate.jira.com/browse/NH-3612
I have a Ticket entity:
public class Ticket
{
public virtual DateTime CreateDate { get; set; }
public virtual DateTime? CloseDate { get; set; }
}
Also I have a linq-to-NHibernte query for select average of (CloseDate - CreateDate) :
var average = SessionInstance.Query<Ticket>()
.Where(x => x.CloseDate != null)
.Average(x => ((DateTime)x.CloseDate).Date.Ticks - x.CreateDate.Date.Ticks);
But above query has a runtime exception by this message :
Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [.Average[Domain.Model.Ticket](.Where[Domain.Model.Ticket](NHibernate.Linq.NhQueryable`1[Domain.Model.Ticket], Quote((x, ) => (DateTime.op_Inequality(x.CloseDate, NULLp1))), ), Quote((x, ) => (Subtract(Convert(x.CloseDate).Date.Ticks, x.CreateDate.Date.Ticks))), )]
Why?