Top ASP.NET Items

Browse by Tags

All Tags » MVC (RSS)
ASP.Net MVC in Visual Studio 2010 Beta 2
Visual Studio 2010 Beta 2 contains ASP.Net MVC 2 in the box so there is no need to install an out of band update to Visual Studio 2010 to develop ASP.Net MVC applications. Phil Haack posted about the in-box experience for Beta 2 andd also provides some info on how to upgrade your ASP.Net MVC 1 apps to ASP.Net MVC 2. From a tooling perspective, all of the new functionality released in ASP.Net MVC 2 Preview 2 for Orcas is available in Visual Studio 2010 Beta 2 including support for Single Project Areas . Additionally, if you look in the Scripts folder of a new ASP.Net MVC application, you will notice that jquery.validate is included as well as a vsdoc file to go with it. I'll post more on how to use jquery.validate in the coming weeks but...
Single Project Add View in ASP.Net MVC 2 Preview 2
Last week we released ASP.Net MVC 2 Preview 2 for Visual Studio 2008 Sp1. In the box support for single project areas is now included and the Add View tool has been modified to streamline this scenario. A walkthrough that creates two simple single project areas can be found here . If you follow the steps in the walkthrough you will notice that Add Controller and Add View are now available in the single project areas in your ASP.Net MVC 2 Preview 2 application. Here are some screenshots that show off the tooling changes. Right-Clicking the Controllers folder of any single project area (Areas –> Blog –> Controllers) will invoke the familiar Add Controller dialog. The new controller will be added to the Controllers folder of the single project...
Walking the tight rope
I think today is an appropriate time to write this post, as Rob Conery is leaving Microsoft tomorrow . “Who?”, you might ask. Rob is the author of the excellent MVC Storefront and Kona series where he explored the challenges in building an MVC-bound storefront application. I’ve been working with Rob for a few months on the continuation of that, which will be the subject of this post. This is challenging for a number of reasons. First, Rob’s are large shoes to fill (he’s a 12, I’m an 11). That’s fine, I’m just going to do things my way and try to have as much fun as possible (and communicate that if I can). Second, the focus of the application has changed and that is a much more important challenge. Rob built this as a learning tool, as much...
A total n00b’s guide to migrating from a custom data layer to Nhibernate: getting started
(Screencast can be found at the end of the post) To be clear when I say “total n00b”, I’m not talking about you, dear reader, I’m talking about me. The last time I wrote any serious data access code was circa 2002. Since then, I got hired by the Evil Empire and started developing new tools to make it easier to build demos of Northwind master-details. I jest, I jest. Or do I? So let me explain what I’m going to talk about in this and future related blog posts. We have this e-commerce application that Rob started and that we’re going to continue developing. Last time Rob touched the data access, he wanted to experiment with going back to less abstraction and to working directly with that interesting data-centric Domain Specific Language, you know...
ASP.NET MVC V2 Preview 1 Released
The ASP.NET team just released the first public preview of ASP.NET MVC Version 2.  You can download it here . Today’s preview works with .NET 3.5 SP1 and VS 2008, and can be installed side-by-side on the same machine as ASP.NET MVC 1.0 (meaning they don’t conflict and your existing ASP.NET MVC 1.0 projects will not be impacted if you install it).  If you have both ASP.NET MVC 1.0 and ASP.NET MVC 2.0 installed you’ll see two ASP.NET MVC project templates within Visual Studio 2008’s “New Project” dialog: The release notes that come with the ASP.NET MVC 2 Preview release detail how to upgrade existing ASP.NET MVC 1.0 projects to use V2 if you’d like to migrate them forward to take advantage of the new features. New Features ASP.NET MVC...
Mocking indexer getters with Moq
This is a follow-up on that other post: Mocking indexer setters with Moq . So thanks to that post, we now know how to intercept the setting of a particular indexed property (in our example, an application variable) and set a local variable with the value that was set by the tested code. Now if you want the application to return that same value when queried by the tested code, you also need to mock the indexer getter. This operation is also not entirely trivial. Here’s how you do it: you do a SetupGet chained with a Returns with a lambda expression as the parameter: mockHttpContext .SetupGet(c => c.Application[ "foo " ]) .Returns(() => ( object )map); That last point about using a lambda is pretty important. If you just use map...
Tell me what smells in WebForms as a view engine
Don’t read too much into this, but I’d love to read your feedback on this. I’m compiling a list of stuff that smells in WebForms when used as a view engine in MVC. Along the lines of: Noisy page directives that are useless for MVC runat=server Page lifecycle For once, you can let the inside troll take over :) Read More...
ASP.Net MVC for Visual Studio 2010 Beta1 Codeplex
ASP.Net MVC for Visual Studio 2010 is available for download here: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28527 . There is no new functionality but you should be able to upgrade your applications to target the 4.0 framework (or leave them as is) if you would like to play with ASP.Net MVC on Dev10. Please read the release notes for a couple of gotchas. If you never read release notes, please note the following: If you are working with Visual Studio Team System 2010 and the Historical Debugger is enabled, Visual Studio might occasionally crash. If you experience this problem, disable the Historical Debugger. You can disable the Historical Debugger in Tools->Options. Note that this will be fixed in Beta 2. Hope this...
Mocking indexer setters with Moq
I quite like MoQ because it makes sense for me. Shamefully, I’ve always had some trouble understanding test code that was using mocks built with other frameworks. With MoQ , I can just grok it for some reason. It’s just super-clear to me. It doesn’t mean I have any idea how it really works but for now I’m just happy with the magic. Anyway, yesterday I wanted to check that a controller action was setting some Application variable (let’s not get into the debate on whether or not it should do that at all). Something like this: application[ "foo" ] = new Foo (); Now how do I enable the object to be set by the tested code? Well, that one is easy, I can use SetupSet on indexers just fine: var mockHttpContext = new Mock < HttpContextBase...
June 7th Links: ASP.NET, AJAX, ASP.NET MVC, Visual Studio
Here is the latest in my link-listing series .  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past. You can also now follow me on twitter ( @scottgu ) where I also post links and small posts. ASP.NET Implementing Incremental Navigation with ASP.NET : A nice article from Andrew Wrigley that describes how to use ASP.NET’s Site Navigation system to create a navigation user interface. Syndicating and Consuming RSS Feeds in ASP.NET : A nice article from Scott Mitchell that describes how to work with RSS using ASP.NET 3.5. Using Expression Builders in ASP.NET : Scott Mitchell has another good article that describes a little-known extensibility...
More Posts Next page »