Thursday, September 22, 2016

Installing Oracle Database server 12c on Windows

If you need to develop against an Oracle Database backend, you will probably want to be able to setup your own Oracle Database for development and testing.

Surprisingly, installing Oracle Database 12c on Windows is very easy!  You simply have to download the Oracle Database 12c downloads from here (http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-win64-download-2297732.html), extract the .zip files and then run setup.exe:
















Oracle Data Access Components for .NET

If you need to access an Oracle database from your .NET application, you will want to install the Oracle Data Access Components (ODAC) on your system.

You can download the ODAC components from here: http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html

If you need to download the Oracle database or the Oracle client, you can get those from here: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-win64-download-2297732.html

Wednesday, September 21, 2016

Clear Recent File and Clear Recent Project List returns to Productivity Power Tools!

With the initial release of the Productivity Power Tools for Visual Studio 2015, the ability to use the commands for "Clear Recent File List" and "Clear Recent Project List" were unfortunately removed and required the usage of a PowerShell script to remove these values instead.

Thankfully, however, these 2 commands have returned to the Productivity Power Tools!

Now, with the most recent release of the Productivity Power Tools, you can once again use these commands directly from the Visual Studio IDE!

You can download the latest version of the Productivity Power Tools from here: https://visualstudiogallery.msdn.microsoft.com/34ebc6a2-2777-421d-8914-e29c1dfa7f5d

Tuesday, September 20, 2016

Differentiating between Project and Assembly References in Visual Studio

I was recently working on a project whereby I was encountering failed builds when the code was pushed up to our continuous integration server, but the build was successful when building on my local machine.

It took me a long time to try and figure out the root cause of this problem, but as it turned out, it had to deal with Project vs. Assembly References!

Unfortunately, in Visual Studio, as soon as you add a Project Reference to your Project, there is no EASY way to determine if a particular reference is a Project or an Assembly Reference!

The best way to try and check if you have a Project Reference is to right click on the References icon and select "Add Reference":


Then, once you have the dialog open, you can "guess" which projects are project references by looking at the checkboxes next to the corresponding project names.

As you can tell, this is a VERY, VERY tedious and error prone method of verifying and validating references in your project and across your solution.

Therefore, if you are like me and would prefer to have different icons for project references vs. assembly references in the Visual Studio IDE, you should definitely vote for this UserVoice item: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/4747824-different-icon-for-project-reference-and-assembly

Persisting State in an ASP.NET MVC Web Application using TempData

When we think about persisting state in an ASP.NET MVC Web Application, most developers think of persistence using Session, Cache or Cookies, but many developers forget about using TempData as an easy means to persist information across ASP.NET MVC Requests!

Many developers frequently use the ViewBag and ViewData dictionary objects, but very few are aware of the TempData object.  The TempData object is especially handy when working with the PRG (Post Request Get) Pattern whereby you post from a controller method and then redirect to another controller method.

The problem with using objects such as ViewBag and ViewData is that they are only valid for that particular controller method request and will not be persistent across subsequent requests.  That is where TempData fits into the picture!

This MSDN article specifically addresses different methods for Passing Data in an ASP.NET MVC Application: https://msdn.microsoft.com/en-us/library/dd394711(v=vs.100).aspx

As you can see from the article, the usage of TempData is specifically geared towards "Passing State Between Action Methods"

You can read more about the TempData Dictionary object here: https://msdn.microsoft.com/en-us/library/system.web.mvc.tempdatadictionary(v=vs.118).aspx

This article also does a great job of explaining the differences between ViewData, ViewBag and TempData and their specific use case scenarios: http://rachelappel.com/when-to-use-viewbag-viewdata-or-tempdata-in-asp-net-mvc-3-applications/

Why I still prefer using TFS vs. using Git

On all of my recent projects, I have been primarily using Git source control mainly because of the features for local feature branches for locally developing features and functionality without committing a branch directly to the main source control repository.

Of course, being a Microsoft developer, I am using Git within the Visual Studio IDE which presents its own challenges since Git support was added to the Visual Studio IDE very recently and mainly as an afterthought for functionality to cater to the needs of non-Microsoft-centric developers.

However, TFS is a platform which has been around for the last 11 years and has very robust and full-featured support within the Visual Studio IDE and provides many more features and functionality directly within the Visual Studio IDE.  In addition, many features are much more easily accessible and usable than with Git support in the Visual Studio IDE.


  1. First of all, Visual Studio has full support for viewing source control for TFS using Source Control Explorer directly within the Visual Studio IDE.  Unfortunately, while using Git, the developer is forced to browse to the repository within the browser in order to view source.
  2. Using Source Control Explorer within the Visual Studio IDE with TFS, you get much better visualization of the branching structure and how branches are interrelated to each other.
  3. Using Source Control Explorer within the Visual Studio IDE with TFS, you also have the ability to view "deleted" files from the TFS repository.  Using Git within the browser, there are no such options.
  4. Performing commits within TFS allows for meaningful commit numbers called "Changesets" which are easily understandable and can be readily remembered.  However, with Git, commits are very long random GUIDs which are neither easily understandable nor remembered.
  5. TFS allows committing just a single file even when there are other pending edits on your file system, while Git ALWAYS requires a commit and pull request before committing/pushing even a SINGLE file.
  6. Using Git within the Visual Studio IDE, only a very small portion of the total commands for using Git are available from a GUI interface.  All other operations require using a separate GIT client such as SourceTree or GitKraken or requires using the Git Command-Line client.  However, using TFS, nearly every operation is available within the GUI while only a few operations require using the TFS Power Tools through the command-line interface.
  7. Code Reviews within Git require a branching strategy and creating Pull requests from within the browser, while Code Reviews within TFS can be done on any committed code and are significantly easier and can be initiated directly from within the Visual Studio IDE.
  8. 3rd party merging and comparison tools such as Beyond Compare can be readily integrated into the IDE while using TFS, however, using Git only supports Visual Studio's built-in comparison and merging by default.  In order to support Beyond Compare for Git requires the installation of the Git Extensions for Visual Studio which still provides incomplete support at best.
  9. TFS allows "Shelving" support directly within the IDE as well as easily reviewing Shelvesets, however, Visual Studio has no built-in support for "Stashing" when using Git.  
So, even though Git is becoming increasingly popular to use as a source control repository, for Microsoft-based developers using the Visual Studio IDE, using Git over TFS presents some significant disadvantages that should be carefully weighed and considered before choosing Git over TFS as the de facto source control repository for your development team and organization.

Friday, September 16, 2016

Using Ajax in ASP.NET MVC Web Applications

If you want to use Ajax in your ASP.NET MVC Web Applications, you can use JavaScript frameworks such as jQuery or AngularJS separately to add Ajax support to your applications, or you can use the built-in support for Ajax provided out-of-the-box by ASP.NET MVC!

To get basic support for Ajax in your ASP.NET MVC, you will need to leverage the Ajax Razor Html Helpers, namely, Ajax.BeginForm and Ajax.ActionLink as follows:

Ajax.BeginForm:

Ajax.ActionLink:

Then, if you want to check whether or not the request was an Ajax Request in your ASP.NET MVC Controller, you can use code such as the following: