in

ExpressionBlog.com

Microsoft Expression Studio Community

This Blog

Syndication

Mirrored Blogs

Browse by Tags

All Tags » ASP.NET MVC (RSS)
  • Want to do cool things with ASP.NET MVC?

    Steve Sanderson is apparently writing two Apress books on ASP.NET MVC . While doing so, he’s been digging deep into the framework and inventing/discovering some pretty amazing things. My favorites thus far are: Partial Requests in ASP.NET MVC Partial Output Caching in ASP.NET MVC I’m yet to use it seriously, but I’m pretty sure this is a big part of what I’ve been looking for when it comes to components in MVC. Definitely going to keep an eye on his blog .
  • ASP.NET MVC and jQuery can now produce legitimate offspring

    You know this by now but my university English professor is a mean sucker and would hunt me down if I didn't provide context for this post. Microsoft will be shipping jQuery with ASP.NET MVC and Visual Studio. I imagine there will be lots to Google about this in the coming days but you can start at the source: ScottGu , ScottHa , John Ressig . I freakin' LOVE this news if for no other reason than I finally have a counter argument to the MVC mainstay complaint "what about my server-side controls?". According to John Ressig's post, Microsoft will be developing controls on top of jQuery. Combine that with the news that Visual Studio will have IntelliSense support for jQuery and you have yourself a happy codin' hillbilly. My underlying interpretation of this is that Microsoft will provide reasonable alternatives to the stock server-side controls using jQuery instead. Rob Connery has already provided a pretty detailed tutorial on creating a paged grid in MVC, and he didn't even use jQuery . Oh yeah, and this is a bold new direction for Microsoft and they're welcoming Open Source and the community and blah blah blah. Whatever, as long as I have something else to say besides "yeah, well, you smell" to people unwilling to give up their GridView. Kyle the Argumentative
  • Can you refactor to MVC?

    Not feeling too subtle today so I've given the punchline away in the title here. After wandering neck-deep into MVP and MVC , I'm now thinking about refactoring brownfield applications toward them. And it occurred to me: is it reasonable to refactor to MVC? Then, is it feasible? Then, is it even possible? I've built started three or four MVC applications and love the framework for greenfield apps. But assuming you have a nice, healthy (and I'm using the definition "of great size") web application, would you go through the exercise of converting it to MVC? Here are some reasons why I wouldn't. First and foremost, your URLs will change. Instead of http://myapp/ProductList.aspx, you have http://myapp/Products/List. Depending on the size of the app, I'm not sure I'd trust a global search and replace for that. Besides which, I'd rather be using one of the helper methods to generate the URLs in MVC. Granted, you might be able to get around this with some combination of HttpHandler or HttpModule. Whether or not there is enough benefit to be gained from MVC to go through this exercise probably depends on the size of the app, your deadlines, and just how much blogging material you want to generate. This segues into my next point. Unless you plan to refactor every page all at once, you need a way to have WebForms pages sitting along side MVC pages. Which means you need to be able to navigate directly to some .aspx pages in some cases, and to controller actions in others. This might be possible in the same project but it makes my head hurt thinking about it. You'll be giving the routing engine a hernia with all the heavy lifting it would have to do. Either that or, again, implement your own HttpModule before the routing module in the pipeline. Alternatively, you'd create a second web project, an MVC one, and move your UI over to it over the span of many moons. Your URLs will really get messed up as you'll be essentially working in two separate web applications. All of this presumes your logic is separated enough to withstand such a change. When talking about refactoring to layers in the brownfield book , we recommend doing so incrementally. That is, start by creating a seam and move all the code into it leaving a little bit behind in the UI. Then repeat for the big bulk of code you moved all the way down the line to the data access. (There, now you don't have to read Chapter 8.) Refactoring to MVC feels like this would be hard to do. Mind you, it shouldn't really be any harder than refactoring to MVP. Maybe just feels that way because of the brownfieldedness of the apps I have swirling in my head. (Full disclosure: many of which I contributed to.) Speaking of MVP, one of the main reasons I think this is too much work is because MVP is such a reasonable alternative. Maybe not 100% idea, but it's a very viable compromise. On the one hand, yes, you still have to deal with the ViewState and the ASP...
  • ASP.NET MVC Sample Project: Suvius.Flamingo

    When presenting on ASP.NET MVC, I use an application I started nigh on two years ago when I was a wee whelp extolling the virtues of Atlas. It's no longer AJAX-y but it does demonstrate MVC and I've put it online at Google Code mostly because I've been promising I would for many months. It's a music catalogue that will extract metadata from all WMA and MP3 files in a folder of your choice and store it in a database. There are some simple controller actions used to query the catalogue in various ways. Check out the ReadMe.txt file for some tips on getting started. Note that you can't just download the code and open it up in Visual Studio. You need to run the build file at least once. There is a batch file that will make this easier the first time (clicktobuild.bat) but bear in mind that this *will* drop and re-create your database. And before you do that, you'll need to create a local-properties.xml file in the confi--...actually, just read the ReadMe.txt. There is a unit testing project in there that I added after the Edmonton presentation. The Edmug guys have whipped their city into shape there because when I said MVC is conducive to TDD, they called me out and said "Prove it, Plaid Man". Hardly complete coverage by any stretch but hopefully demonstrative enough. If you're semantically inclined, this does indeed mean I built the app without using TDD. There's actually a very good reason for that. You see, a plague of locusts appeared when I was first building it and they told me in locust-ese that if I used TDD, they would become a blight upon the land. I'm sure you see my dilemma. Final note on the name. Suvius is just a code name my brothers and I use and I've always liked the sound of it. Flamingo is the national bird of the Bahamas. How do they relate to an online music catalogue application? They don't. I've got a rant I've all but memorized on people's fixation on names but the short version of it is: Amazon, Sun, Java, Oracle, eBay, Facebook, Windsor, and Hibernate. I'd tell you to enjoy but that implies some sort of emotional attachment to the project. Kyle the Flaming-o
  • MVC vs. MVP: A Hillbilly's Journey

    Yes, I know you've read this before so stop rolling your eyes and skip it if you're not interested. I'm not coming at this from the perspective of an expert imparting knowledge but as a hillbilly who has ignored the question too long. And now that I have to dive into it for the book , all the vagueness that I've been able to shunt aside to a little corner of my brain has surfaced like a long-lost brother beggin' for college money. So since I work from home without a lot of peers, my options are to talk it out here or to my daughter, who cries when her favorite singer is kicked off American Idol. Pre-requisite reading: Martin Fowler on GUI Architectures Martin Fowler on Passive View Martin Fowler on Supverising Controller Martin Fowler on Presentation Model Jeremy Miller on the difference 'twixt MVC and MVP I've looked through a number of other links but these are the ones I feel provide sufficient background and are suitably authoritative. Plus, I don't want to rehash the definitions of each pattern. So as I was waxing eloquent on Passive View and Supervising Controller, the thought crossed my mind, "I'm not seeing a lot of difference 'twixt these and my understanding of MVC. They have the same components and the diagrams look similar enough..." Martin Fowler's contrast between the two didn't help much: MVP uses a Supervising Controller to manipulate the model. Widgets hand off user gestures to the Supervising Controller . Widgets aren't separated into views and controllers. You can think of presenters as being like controllers but without the initial handling of the user gesture. However it's also important to note that presenters are typically at the form level, rather than the widget level - this is perhaps an even bigger difference. The problem stemmed from the way I'd explained the difference in my recent presentations on MVC. Specifically, I said that in MVP, the entry point was the View (aka. the aspx page) while in MVC, it is the Controller. While this is technically accurate, I now think it's a consequence of the *real* difference. Another thing blocking my understanding was that I spent too much time reading the theory and not enough time just reviewing my own code. I've implemented Supervising Controller in a web app before and my tag cloud seems to think I've done some work in MVC recently. If I had done that, it would have been quite a bit clearer. In the MVP patterns, there is a lot of synchronization and infrastructure code that is absent from MVC. The presenter and the view communicate back and forth a lot. For example, consider a button click in an MVP web page. Being a nice, decoupled view, it would probably look like this: protected void buttonFerment_Click( object sender, EventArgs e ) { _presenter.Ferment( ); } That is, the view passes the request on to the specific presenter its wired up to. And the presenter in turn would do whatever it needs to...
Powered by Community Server (Commercial Edition), by Telligent Systems