ASP.NET 4.5 and ASP.NET MVC 4 Support in ReSharper 7September 24th, 2012 by Dmitri Nesteruk
In spite of all the wonderful things happening in the Windows 8/WinRT world, ReSharper continues to provide support for existing technologies such as ASP.NET. In the latest release, ReSharper is augmented with new features for supporting ASP.NET 4.5 and ASP.NET MVC 4. Here’s what we’ve got in store.
In ASP.NET 4.5, Web Forms support includes several improvements when working with data. Here are the ones that ReSharper now understands and supports:
Strongly Typed Data Controls — instead of using
Bind()for data binding, ASP.NET 4.5 lets developers declare the type of the element being bound via the
ItemTypeproperty and provides the
BindItemproperties inside binding expressions. ReSharper provides full support for these new constructs with code completion:
Inspections, fixes, refactorings and other typical ReSharper features are also supported:
Model Binding — this mechanism lets one bind controls to data acquired from a particular function on the page, defined in the
SelectMethodproperty. Once again, ReSharper provides typical features such as code completion…
… as well as navigation, refactorings and other features typical for a C# property. Additionally, ReSharper is smart to check the return type of the
SelectMethodand issue a warning if its type does not match that of the
ReSharper is now also aware of HTML Encoded Data-Binding Expressions, which let developers add a colon (:) to the
<%#prefix to ensure the subject of a data binding expression is HTML-encoded.
Of course, ReSharper also supports typical features such as code completion and validation inside the string literals that are used in the
ASP.NET MVC 4
ReSharper 7 extends its support for ASP.NET MVC to projects that use the ASP.NET Web API — the new framework for creating HTTP services. This means typical features such as inspections, navigation and refactorings are now available for Web API projects.
In addition, ReSharper now supports the Display Modes feature of MVC4, which lets an application select views depending on what browser makes the request. For example, ReSharper’s Go to Declaration on a view reference will show all the view files with different display modes:
In a similar fashion, performing a Find Usages on a view file with a display mode suffix will correctly locate its usages. Also, ReSharper is smart enough to detect when custom display modes are defined.
We hope you find these new ASP.NET-related features beneficial in your everyday development. Meanwhile, we continue to add more goodness to our support of the ASP.NET stack. Stay tuned for more!