Code:
public IEnumerable<CalendarItem> GetCalendarItems(DateTime? startDate = new DateTime?(), DateTime? endDate = new DateTime?())
{
if (startDate.HasValue && endDate.HasValue)
{
var items = session.Linq<CalendarItem>()
.Where(x => x.EventDate >= startDate.Value && x.EventDate <= endDate)
.ToList<CalendarItem>(); //Error Here
return items;
}
//var items = session.QueryOver().OrderBy(x => x.EventDate);
return session.CreateCriteria<CalendarItem>().List<CalendarItem>().OrderByDescending(x => x.EventDate);
}
Exception
Method not found: 'System.Collections.IDictionary NHibernate.ISessionFactory.GetAllClassMetadata()'.
Reference problem? Any help would be appreciated.
Edit
I tried using a non-nullable date time and that gave the same error. Something is trying to call :
System.Collections.IDictionary NHibernate.ISessionFactory.GetAllClassMetadata()
When I check out ISessionFactory via vs2010 the medadata does not show the”GetAllClassMetadata()” method.
I ended up ripping out my references for fluent/nhibernate. I used nuget to get the fluent package, but there may have been an issue with it. I downloaded the latest assemblies for fluent nhibernate and removed any reference to those asseblies I could find. This seems to have fixed the issue.
BTW…I am now using Query() rather than Linq()