ASP.NET MVC
ASP.NET MVC
ASP.NET MVC 2 has been announced with the release of ASP.NET MVC 2 Preview 1. After having read through the rather lengthy overview of new features written by Scott Guthrie. Many new great features have been listed, but the two that tend to stand out the most is support for areas by project and template helpers for editing and displaying data. Project based areas seemed to be an official solution to my categories dilemma. On further inspection, it becomes apparent that the projects are not logical containers to an area. The areas implementation is still the original namespace based...
For the last few months, I've been attempting to create WebForm controls specifically designed to work well with ASP.NET MVC and the ViewPage (as well as ViewMasterPage and ViewUserControl). Yesterday, as I near finish with my implementation, I find that Microsoft has already done so themselves. However, on second look, it's not finished, though does appear to be a great start. As I debate whether to finish and bugproof my own implementation, choose to use Microsoft's implementation when they finally have time to finish it, or simply derive Microsoft's current implementation to better fit my needs, I'll describe what I've...
I've finished implementing support in ASP.NET MVC for processing requests and rendering views using categories. Only things left now is to add extension methods that simplify the process of using categories, as well as finish implementing discoverability (i.e. SiteMapProvider).
In the future, I wish to also deal with inline page code. I find it rather ugly, as well as having no page designer support. Although I do not use the page designer to design my page, I do tend to use it as a "quick preview," as well I tend to work with others who require page designer support. I've gone...
Last night I had an idea for a different approach for grouping related controllers into a category that made so much sense, I'm surprised I was able to imagine it. The idea of actions being grouped into a controller parallels a set of methods being grouped into a class. Taking it a step further, grouping a set of controllers into a category would parallel grouping a set of classes into an assembly. Under this approach, each category would be created as a separate project, referenced back into the main web application. This has a few advantages over...
I was working on a method for making controllers, as well as their categories and actions, discoverable, and noticed a few Descriptor types. On the surface, they appear to provide a few methods and properties that make it much simpler to query information about Controllers and Actions than using Reflection alone. Obtaining filters, attributes, and even lists of actions from a controller, or lists of parameters from an action, can be made with a simple method call, rather than the possible many lines of using confusing Reflection methods. However, this isn't exactly the case; the Descriptor types are abstract, their...
In order to support categories of controllers in ASP.NET MVC, one must create a new controller factory. The IControllerFactory interface defines two methods to implement, CreateController, which passes in the controller name pulled from the route data, as well as the RouteContext itself, and ReleaseController, which occurs at the end of the request, allowing the controller to be freed. One limitation of CreateController method is that it only gives the controller name, but not the category name. This isn't much of an issue, it's possible to obtain the category name by calling the GetRequiredString method from RequestContext.RouteData object (this is...
For some time, I have been desiring a method for grouping a set of related Controllers into categories. A search for such a category style scheme showed me that, in the web MVC world, such a concept is known as areas, and I found a few examples of people implementing such features on top of ASP.NET MVC. http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx http://blog.codeville.net/2008/11/05/app-areas-in-aspnet-mvc-take-2/ Both of these are the same implementation, with the former having little flexibility and being very fragile, with the latter adding flexibility at the expense of complexity, while still being as fragile. To add...