开发者

Why cant I use LINQ in my views?

开发者 https://www.devze.com 2023-01-12 06:09 出处:网络
The model being passed to my view is of type tblUser - so I expec开发者_StackOverflow中文版ted that I would be able to:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消