I'm trying to create a strongly typed partial view
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Pt.Data.Services>>" %>
<table>
<% foreach (Pt.Data.Services item in Model)
{ Html.RenderPartial("ServiceItem",item); } %>
</table>
in Controller
IEnumerable<Services> Model=null;
using (tl ctx = new tl(Config.ConnectionString))
{
Model = ctx.Services.ToList();
}
return View("List",Model);
This working well when running at project with binary assembly System.Web.Mvc referenced. But if remove binary assembly and add project with mvc sources(!) to make some debug, it stops recognizing strongly typed views.
It's working like a ViewPage instead of ViewPage<TModel>
As result getting error:
Compiler Error Message: CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'
and others the same nature.
My question:
- Why running sources of MVC is breaking down that is working with assembly referenced ?
- How to make sources to run correct?