I'm iterating through a collection on my view model. The collection contains HealthLifeDentalRates which implement IBeginsEnds. I have a Display Template BeginsEnds that displays the date range. This results in very slow performance. If I simply the date range (see commented code), it's fine. I think how I'm defining the lambda is the problem but not sure how to change it.
<% foreach (var item in Model.Data.OrderBy(x=x.HealthLifeDentalRateCode))
{ %
<tr>
<td>
<%= Html.Encode(item.FiscalPeriodString()) %>
</td>
<td>
<%= Html.Encode(item.HealthLifeDentalRateCode) %>
</td>
<td>
<%= Html.Encode(item.Rate) %>
</td>
<td>
<%= Html.Encode(item.IsDental.YesNo()) %>
</td>
<td>
<%= Html.DisplayFor(i = item, "BeginsEnds") %
- <%= Html.Encode(item.Ends.ToDateString()) % --
<%= Html.Encode(String.Format("{0:g}", item.Loaded)) % - <%= Html.Encode(item.LoadedBy) %
<% } %>