English 中文(简体)
ASP.NET MVC 3 - What features do you want to see? [closed]
原标题:

I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally cleaned up the subfolder mess we had in our large scale application. As I dive deeper into all the improvements and changes that were made I still keep thinking to myself man it would be nice if they had x in this release. For instance, I would love it if they had some sort of dependency injection built in instead of having to use third party solutions.

My real question is now that ASP.NET MVC 2 is out in the wild, what features do want/wish the team had implemented and hope they will implement for ASP.NET MVC 3?

EDIT

Looks like dependency injection is built in for the first preview release of ASP.NET MVC 3! I like the features added so far. ASP.NET 3 preview one is out!

最佳回答

I think MVC 3 will not be too dramatic with it s improvements, but more steady and gradual.

The ASP.NET MVC 3 Roadmap has a snapshot of what the team are apparently looking at implementing in the next release and some of the points are very interesting.

I think my favourites from that list would probably be:

  • More AJAX Helpers: This ll bring the framework more in line with the Webforms world which has all these helpers already and to some degree, acts as a barrier to some people taking up the platform.
  • More Dependency Injection stuff - for those that want it, this is great. :)
  • Improved Caching support is the big win for me. Having that built right into the framework would be a great benefit and could result in some nice performance savings.
  • Additional ValidationAttributes wouldn t go a miss either. While the facility is great to add them, a good library of the common ones, such as Email and PropertiesMustMatch and so on.
问题回答

I would like the complete removal of all magic strings.

I really wish they d add the following:

  1. Spark-style conditionals and loops using html tag attributes.
  2. Updated: Visible project property to toggle compile-time validation of views.
  3. Something to verify/validate that my routes are correct.
  4. Membership provider solution that uses int instead of Guid for identification and allows mapping profile fields to a custom table rather than the generic but slow default.
  5. Lambda-based helpers to avoid magic strings (currently in MvcFutures)
  6. T4MVC template to auto-generate strongly typed helpers
  7. Project wizards or templates to get a template that is already setup for IoC and similar concerns, preferably with a selection dialog to choose which framework to use for IoC, unit testing, etc.
  8. Additional attributes (both filters and validation).

Hmmm, that s all I can think of right now :)

Tooling (T4 templates) to create Moq objects for unit testing would be very cool. Testing for certain objects in the framework is unnecessarily complicated, and having the ability to code-gen some of this would be very beneficial.

I would like:

Tooling

  • An alternative listing view using ajax e.g. using jqGrid (implementing sorting, pagination, search)
  • Enhancements to CRUD Pages detect entities relationships for entity framework classes, and to use another set of components based in fields type e.g. just as Dynamic Data does : )

As ASP.net MVC 3 will be .net 4 only, I d like to see some stuff around asynchronous controllers and all the other new async/multithreading functions that .net 4 brings.

I d like to see built-in support for things like IronRuby

MEF support would be nice.

I d like to see a new way of handling routing, to make it easier to developer REST services. Currently I have routes like this:

context.MapRoute(null,
                 "api/posts",
                 new { controller = "Post", action = "Get" },
                 new { httpConstraint = new HttpMethodConstraint("GET") });


context.MapRoute(null,
                 "api/posts",
                 new { controller = "Post", action = "Insert" },
                 new { httpConstraint = new HttpMethodConstraint("POST") });


context.MapRoute(null,
                 "api/posts/{id}",
                 new { controller = "Post", action = "Update" },
                 new { httpConstraint = new HttpMethodConstraint("PUT") });


context.MapRoute(null,
                 "api/posts/{id}",
                 new { controller = "Post", action = "Delete" },
                 new { httpConstraint = new HttpMethodConstraint("DELETE") });

To a new person using ASP.NET MVC, it s very unintuitive to create anonymous objects to handle routing. I d like to see it revised to something like this (and since we re using C# 4.0):

context.MapRoute("api/posts",
                 controller: "Post",
                 action: "Get",
                 httpMethodConstraint: HttpMethodConstraint.GET
                );

context.MapRoute("api/posts",
                 controller: "Post",
                 action: "Insert",
                 httpMethodConstraint: HttpMethodConstraint.POST
                );

context.MapRoute("api/posts/{id}",
                 controller: "Post",
                 action: "Update",
                 httpMethodConstraint: HttpMethodConstraint.PUT
                );

context.MapRoute("api/posts/{id}",
                 controller: "Post",
                 action: "Delete",
                 httpMethodConstraint: HttpMethodConstraint.DELETE
                );

This would make it more discoverable as well.

I d like helpers that automatically scaffold index views. Maybe something like IndexDisplay(), IndexDisplayFor(), and IndexDisplayForModel().

I d like templating to auto-generate buddy classes on any given model.

i also use simplicity feature like most of thing without helper such as html-helper i thing that development in asp.net MVC 3 is better way to learn MVC 3 in future.

The two things I d like to see most are straightforward dependency injection in views, filters, etc., and (I know this is supposedly on the way with the Razor view engine) is to be able to test my views in isolation from the ASP.Net pipeline (perhaps including doctype validation and/or some type of JavaScript compiling/validation).

Here are a few other ideas:

  • It would be nice to be able to package up a UI component (views, templates, view models, etc.) for reuse across multiple projects. I m guessing this is currently possible somehow, but I just don t need it badly enough to figure it out myself.
  • The idea of controllerless actions intrigues me, particularly from a SRP standpoint.
  • Better support for the Post-Redirect-Get (P/R/G) pattern... it just seems like there should be intrinsic support for this very important pattern.

more controls and helpers would be really nice, especially an (ajax) grid.

I would like to see areas assembly support (I mean many assemblies with different areas) + dynamic loading, something like plugins.

Edit: And we have preview 1 today: http://weblogs.asp.net/scottgu/archive/2010/07/27/introducing-asp-net-mvc-3-preview-1.aspx

Anybody happy ? :>





相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签