ASP. NET support in resharper 5

Source: Internet
Author: User

Reference address: http://hadihariri.com/blogengine/post/2010/01/20/ASPNET-Support-in-ReSharper-5.aspx

Although I mentioned briefly in the past some of the new features ASP. net MVC features resharper 5 supports, I thought it wocould be a good idea to sum up the main ones in a single post and go into a little bit more detail on them.

ASP. NET

Resharper's support for ASP. net is not restricted only to MVC. in fact, most of the new features are for general ASP. net, be it webforms (also known as traditional, classic, for historical purposes only ?) Or MVC.

Go to file Member

As part of the code navigation features of resharper, you have the possibility to locate a file member, be it a method, property, class, etc. Very easily by usingGo to file Member(Alt + \) option. you can search instantly and hit enter to navigate to the specific one. [For the record, I'm using the Visual Studio keyboard scheme. if you're using intellij (Why ?) Go to the web site and download the PDF Mapping Files.]

Notice how it looks for anything that matches the characters introduced, so for instance typing "exc" wocould give us all those with the word "exception"

Well you now have this functionality in aspx, ascx, asax and web. config files also as of resharper 5!

The same goes for the file structure tool window (CTRL + ALT + F ).

Go to related files

Several times, An ASPX has references to other files, such as Cascading Style Sheets, JavaScript files, master pages and user controls. you can now navigate to these files efficiently by using the go to related files (CTRL + ALT + F7)

Master pages

Version 5 also adds support for Master and content pages. To begin with, we have added support for navigation. UsingGo to Declaration (CTRL + left mouse) onContentplaceholderidWill take you from the content form/page to the corresponding contentplaceholder of the master page

If you are in the master page, you can navigate to all its inheritors (SHIFT + ALT + F12)

You can also create content place holders from usage. when definingContentplaceholderidThat does not exist, you have the option to create it in the master page (Alt + enter)

Last but not least, in a page that uses a master page, you can generate content place holders by pressing Alt + INS

Which in turn will bring up a dialog box for you to pick and choose what you want

User Controls

You can now navigate to user controls as well as automatically import the correct references.

File generation

There are new code generation options for ASP. NET with version 5. By pressing Alt + INS in the Solution Explorer, we are presented with a popup menu

Where you can choose from a selection of items to generate. you can also access this menu from anywhere (not only in the Solution Explorer) by now pressing CTRL + ALT + INS. this is actually an awesome new addition to resharper 5 (CTRL + ALT + INS) and it removes even more friction when create new items!

We're re asked for a name (which is the base minimum required to create an item) and if the item selected requires more information, then we'll be prompted accordingly. for example, when creating a webform with master page, it's convenient to specify which master page we want to use. in this case, once the page has been created, we'll be given a chance to provide this information

I have to say, that I love CTRL + ALT + INS in resharper 5.

Refactoring and maintenance ance

In terms of refactoring and coding between ance there are a few new features. One of them is the auto-update of ending tags. If you have for instanceDivTag, and want to change itSpan, As you start typingSpan, The end tag is automatically updated to reflect the changes you're making live.

If you have a series of elements that you want to surround within a tag, you can easily do this by selecting all the elements and choosing surround with template (CTRL + e, U)

ASP. NET MVC

Resharper 5 treats ASP. net mvc as a first class citizen. As such, it now has knowledge of concepts such as views, controllers and action.

Navigate to view

For those of you working with ASP. net mvc, you might have noticed that views are now underlined in actions

When you click on the view with Ctrl + left mouse, you'll be presented with a dropdown menu

Here you have two options. The first is to navigate to the source forViewMethod (navigation to external sources is another new feature of resharper 5 ). the second option is to go to the view. although you can navigate to the view in Visual Studio by right-clicking and selectingGo to view, One advantage the underlining adds is that it serves as hint for non-existent views, as you can see in the Action below, which doesn't have a corresponding View File.

View discovery also works with named views. If a named view exists, the string literal will be underlined

On the other hand, if it doesn't exist, it will be highlighted as an error, once again providing you the benefit of discovering any missing views earlier on.

Action links

Those of us who have worked with ASP. net MVC applications, know the problems with using strings when defining actionlinks. not only do you run into issues when refactoring, but misspelling an action or controller causes unnecessary pain. some of us, including myself, have often resorted to using the expression based actions available in the MVC futures library.

Resharper 5 now provides intelliisense, preventing you from mistyping actions and controllers

Similar to named views, if you define a non-existing action, you will get it highlighted. the difference here is that by pressing Alt + enter, resharper will create the action for you (create based on usage)

And much like views, you can now navigate to actions and controllers from an actionlink by choosingGo to Declaration(CTRL + left mouse) on the action and controller respectively.

User Controls

Navigation is also provided for User Controls

As well as intelliisense

Summary

I 've outlined some of the main features that resharper 5 brings to the table in regard to ASP. net. there are too smaller features that you can discover eventually as you play with it more. if you haven't yet, make sure you download 5 from jetbrains. don't forget to follow resharper on Twitter if you want tips, tricks and latest info.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.