Lately I’ve been playing around with Asp.Net Mvc. I’m trying to adapt the NerdDinner sample for a project I’m working on. The sample includes a class called PaginatedList<T>. PaginatedList<T> looks something like this:
public class PaginatedList<T> : List<T> { public int PageIndex { get; private set; } public int PageSize { get; private set; } public int TotalCount { get; private set; } public int TotalPages { get; private set; } }
My controller method looks something like this:
public ActionResult FindBusinessesByName(string businessName, int limit, int page) { BusinessRepository repository = new BusinessRepository(); PaginatedList<Business> paginatedBusinesses = new PaginatedList<Business>(repository.FindBusinessesByName(businessName), page, limit); return Json(paginatedBusinesses); }
I’m using jQuery to get a PaginatedList of businesses from my controller. I use the list of businesses to create an unordered list to display the business information. I haven’t played with jQuery or json serialization much so I was surprised to see that only the business data was returned. The extra properties on the PaginatedList were not. I dug around a bit and downloaded the newly released source for Mvc (woot!). I found the two lines in JsonResult.cs that do the serialization:
Read the rest of this entry »
Error generating MVC view for Entity Framework model
Entity Framework, Error, Mvc April 4th, 2009
I’m trying to generate a view for Asp.Net MVC 1.0 using an Entity Framework model. This is from Details.tt. Anyone seen this error?
I get this the first time I try to generate:
error CS0234: Compiling transformation: The type or namespace name ‘Data’ does not exist in the namespace ‘System’ (are you missing an assembly reference?)
About