Why cant I use LINQ in my views?
The model being passed to my view is of type tblUser
- so I expec开发者_StackOverflow中文版ted that I would be able to:
<% Model.tblLogins.Where(l => l.date > DateTime.Now.AddDays(-7)).Count() %>
However, the .Where()
part is not available as an option? I have the following in my web.config
but hasnt helped:
<add namespace="System.Linq"/>
<add namespace="System.Data.Linq"/>
<add namespace="System.Collections.Generic"/>
Has anyone had this problem before? Thanks for any assistance :)
SOLUTION
Uninstall Resharper 5!
Really sorry to have wasted everyone's time - as it turned out, the views actually worked fine with the LINQ in there, its just that Resharper wasnt picking up the references. I only installed Resharper 5 about three hours ago - guess that didnt last long - back to Telerik JustCode :P
精彩评论