Logic doesn't work in WorkContext

Topics: Writing modules
May 28, 2011 at 1:04 AM

I noticed something odd that I'm wondering if there's a different way to do it to get it to work.

If I pass a ViewModel containing an IEnumerable<model> named thisObject to a View, I can get the count of the records in that IEnumerable by simply doing


However, if I'm passing the Model to a WorkContext in my View as such

@{WorkContext.Layout.BeforeMain.Add(New.SubView(myview: @Model), "5");}

and then attempt the same thing in SubView using


I get an error. Accessing the model objects values works with no problem in SubView, I just can't seem to do any type of aggregation functions like Count().

Is this expected and is there any way around it? Thanks

May 28, 2011 at 2:16 AM

You can cast it to an IEnumerable, then use count.