Part 4: Speed up your development with JetBrains' ReSharper and DevArt dbForge SQLComplete

October 27th, 2014

In this fourth part of the series, we talk about using add-ons to Visual Studio to kick your coding into high gear.

In the Resources section, I talk about the tools I use for developing .NET websites. These tools I'm referring to are Jet Brains' ReSharper and DevArt dbForge SQLComplete.

These tools are considered indispensable while coding and I have been reimbursed many times over through the productivity features of each product.

This fourth post will take ReSharper and DevArt dbForge SQLComplete further past their original existing code enhancement features and expand on how to make each product even better. 

JetBrains ReSharper

ReSharper has been around for a long time (I had version 4.0) and has, what I would call, the best book-to-software translation around. The book I'm referring to is the Refactoring: Improving the Design of Existing Code (affiliate link) book.

So let's talk about how we can extend ReSharper even further.

Extend the Extension

I posted a month ago about the best JetBrains ReSharper Extensions out there. Yes, ReSharper has a way for you to extend the extension.

I won't go into each addon, but the majority of each one in the post is installed in my copy of ReSharper (except Clippy). So when I write bad code, my editor goes NUTS and everything is underlined until I fix it.

If you have an idea to make your coding even more productive that isn't included in ReSharper or that is specific to your enterprise needs, start coding an extension for ReSharper. The SDK is located here.

Smart Templates

If you want to speed up your development, I would highly recommend Smart Templates. Smart Templates takes a snippet of code, applies parameters to it, and makes it easy to call through the IDE.

In the last article, I used T4 templates to generate Repositories. If it's strictly a new system that requires repositories, I use T4.

But what if you need just one repository. Hence, the need for the templates.

Here is one template for a repository.

using System.Data.Entity;
 
namespace $namespace$
{
    public class $class$Repository : $class$Repository<$class$>, I$class$Repository
    {
        public $class$Repository(DbContext objectContext)
            : base(objectContext)
        {
        }
    }
}

On the right-hand side when you cut-and-paste this, use these parameters for the template.

Shortcut: _repoclass (or make up your own)
Description: <whatever you want>

Parameters:

ReSharper will detect any new parameters that start and end with $ and place them in your parameter list on the right-hand side. So you can have a $blueberrypie$ parameter and it will ask you what you want to associate that term with in the selection dialog. 

After you have setup all of your parameters and code, save it and create a new class in your project.

Erase everything inside the editor and type "_repoclass" (or whatever you decided to name it) to see the fruits of your labor. When you hit enter, you'll see the code appear and start prompting you for all of your parameters.

Smart Templates in ReSharper are MadLibs for Developers! HA!

As I said in the last post, once you have a technique nailed down, start honing it by building your library of Smart Templates and always keep them around...maybe save them on a Dropbox, Drive, or OneDrive storage service across devices.

ReSharper Alternatives

If you don't like JetBrains tools (which I can't believe someone would), there are some alternatives to ReSharper. The code optimization alternatives for Visual Studio include DevExpress's CodeRush Refactor! Pro and Telerik's JustCode. These are the major players in the code optimization market.

DevArt dbForge SQLComplete

To complement ReSharper on the database side, DevArt SQL Complete is like an IntelliSense for SQL Server and template generator. I've been using SQLComplete for a long time as well and it has paid for itself many times over.

SQL Complete installs itself into multiple versions of Visual Studio and multiple versions of SQL Server, so you get the full package experience in either environment. It's well worth the investment.

This could turn into a review, but this post is meant to be a productivity enhancer, so I will digress and talk about this product in a future post.

For now, let's see how we can speed up and optimize your database skills.

SQL Formatter

If you've EVER received a particular SQL query or Sproc (Stored Procedure) and you couldn't read it to save your life, it WILL slow you down because it's something that takes time to translate.

That's where the SQL Formatter comes into play. The SQL Formatter option in SQLComplete is probably the most extensive formatter I've ever seen.

If you want to modify your formatting options, go into you options under SQL Complete and select Options. Under the Formatting category, select Profiles.

Click Edit Profile to change your formatting preferences (and brace yourself).

For those who look for the smallest bit of control over formatters, this should be the mother-load for them! If you have any questions about what each format looks like, you have some sample SQL on the right.

Once you go through and fine-tune all of your preferences for the SQL Formatter, you should be able to read just about any SQL query and have it formatted quicker that you can say "SQL Complete is the best."

Snippets Manager

The other feature that made me snatch up SQLComplete was the Snippets Manager. This is the equivalent to Smart Templates in ReSharper, but for SQL Server.

There are a number of commands that I use extensively on a daily basis at work and the Snippets Manager provides the ultimate way for me to execute those commands at the press of a couple keystrokes and picking a table to execute it against.

The interface may look a little different, but the concept is exactly the same.

While I have added a couple scripts that are specific to the company, I wouldn't be able to share them, but as you can see, the amount of pre-built scripts included should be enough to spark your imagination to build your "SQL library" of tools.

Conclusion

While these are my only two picks for speeding up your development, each company (JetBrains and DevArt) has a number of other tools that are well worth the money.

DevArt isn't just geared towards SQL Server. They support a number of database platforms including Oracle, MySql, or PostgreSQL. Check out their database tools. They have a lot.

Since I've been a .NET developer for several years, I've accumulated a lot of JetBrains products as well. Make sure you check out their .NET tools.

In the last part of this series, we'll talk about how to supercharge your data layer with an ORM.

Series: How to take your ASP.NET MVC development to ludicrous speeds.

  1. Transforming XML/JSON/CSV into Classes
  2. Use pre-built applications
  3. T4 (Text Template Transformation Toolkit)
  4. ReSharper/SQL Complete
  5. ORM (Object Relationship Management)

Do you have any other tools that you cannot live without? Post your comments below.