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