Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using linq in razor template #115

Closed
talarari opened this issue Jul 9, 2013 · 5 comments
Closed

using linq in razor template #115

talarari opened this issue Jul 9, 2013 · 5 comments

Comments

@talarari
Copy link

talarari commented Jul 9, 2013

hey,
upgraded from version 2 to 3.2
this used to work
@Model.SomeList.Sum(a => a.Amount)

now i get this exception:
Unable to compile template. Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type

works if i do this:
@((MySpecificModelType)Model).SomeList.Sum(a => a.Amount)

why does this happen? anyway of using Sum without casting?

thanks!

@coxp
Copy link
Contributor

coxp commented Jul 9, 2013

Can you try pull #110 and see if it solves your problem?

@coxp
Copy link
Contributor

coxp commented Jul 15, 2013

Fixed in v3.3.0

@coxp coxp closed this as completed Jul 15, 2013
@lookitstony
Copy link

I am on version 3.4.0 and i am still having to do this.

((List)Model.AdsActivity).Take(10)

Is this part of the fix above?

@huangyedie
Copy link

image

Why there is no 3.3 version of this

@huangyedie
Copy link

@coxp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants