Tuesday, October 25, 2016

Upgrading to Windows Server 2016

Now that Windows Server 2016 has gone RTM, I thought I would try to see if I can upgrade my existing Windows Server 2012 R2 systems to Windows Server 2016.

As part of the upgrade process, I had to uninstall "VMWare Tools" and "Mcafee VirusScan Enterprise 8.8i" before proceeding with the upgrade as you will see in the screenshots below:

After completing the upgrade, all of my applications seemed to working fine and intact!  Piece of cake!!

Configuring NuGet for Telerik's Private NuGet feed

If you are a licensed user of Telerik's products, you can configure NuGet on your system to authenticate to Telerik's private NuGet feed using the instructions provided here: http://docs.telerik.com/kendo-ui/aspnet-mvc/nuget-install

Unfortunately, since you cannot configure authentication credentials via the Visual Studio User Interface, you will have to do this through the command line.

Alternatively, you can also set up your own Private NuGet feed following the instructions provided here: http://www.telerik.com/blogs/power-your-projects-with-telerik---now-with-the-convenience-of-nuget

If you follow this option, you simply download the NuGet packages from your downloads available in your Telerik account and then upload them to your private NuGet feed in order to make them available to all of your developers.

That is all there is to making Telerik packages readily available via NuGet!

Friday, October 21, 2016

Performing Entity Framework Code First Migrations step-by-step

If you need to perform Entity Framework Code First Migrations, you will probably end up following this article: https://msdn.microsoft.com/en-us/data/jj591621(v=vs.113).aspx

However, as with most Microsoft articles, the documentation leaves a lot to be desired...

Therefore, I will provide a more thorough step-by-step walk through on just how to do this!

  1. After opening up the Package Manager Console, you will want to make sure you choose the "Default project" before running the command to "Enable-Migrations"

  2. This will then create a Configuration.cs file shown as follows:

  3. Next, when you run "Add-Migration <MyMigrationName>", then you will get the following message along with the migration file added to your project:

  4. You can then run the "Update-Database" command if you want to run the command directly against the database. However, if you are like most developers and want to know what the database script looks like before it is applied to the database, you can instead run the "Update-Database -Script" command which will generate a SQL script instead which you can then save off for reference!

  5. For every change each developer makes to the Entity Framework Code First models, you simply repeat the "Add-Migration" and "Update-Database" steps respectively (corresponding to the Code First model changes that were made) and you can ignore the "Enable-Migrations" command.  That is all there really is to it! :-) 

Dependency Injection with ASP.NET Web Forms

Most developers have used Dependency Injection with ASP.NET MVC and ASP.NET Web API, but it has typically been difficult to set up Dependency Injection with an IoC (Inversion of Control) container.

Well, now Microsoft is offering guidance on how to set up Dependency Injection with an IoC container such as AutoFac for use within your ASP.NET Web Forms applications: https://blogs.msdn.microsoft.com/webdev/2016/10/19/modern-asp-net-web-forms-development-dependency-injection/

While using Dependency Injection in an ASP.NET Web Forms does not remove all of the problems typically associated with developing ASP.NET Web Forms applications, but it does go a long way to reduce the code dependencies found in Code Behind files and makes the overall code base that much cleaner!

Windows 10 Licensed Virtual Machines available for download!

In the past whenever you have wanted to download a Windows Virtual Machine from Microsoft, you would only be able to download an evaluation virtual machine that would expire after a certain period of time.

Of course, for those developers that wanted a non-expiring virtual machine they could immediately download and license, this was a bit frustrating.

Thankfully, though, Microsoft listened to its user feedback and is now offering licensed Windows 10 Pro virtual machines!

You can read more about these Windows 10 Pro Virtual Machines here: https://blogs.windows.com/buildingapps/2016/09/30/just-released-windows-developer-virtual-machines-september-2016-build/#6eQPtyU0dF6M78Qq.97

You can then download the licensed Windows 10 Pro Virtual Machines from here: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines

Tuesday, October 18, 2016

FREE Time Tracking solution

If you have a need to track time for your development team members, there are a number of invoicing solutions out there, but most of them cost $$.

Therefore, if you are looking for an FREE time tracking solution, then you should look no further than TMetric!


The current promotion for TMetric provides FREE hosted Time Tracking for a limited time, but will eventually move to a $3/user/month model.

Even at the pricing structure, this is much more inexpensive and affordable than similar time tracking solutions so it is definitely worth your while to check out this solution!

Handling multiple Foreign Keys to the same database table in Entity Framework Code First

I recently encountered a requirement while working with Entity Framework Code First that required mapping more than 2 foreign keys to the same database table.

The convention for Entity Framework Code First, by default, does not make this easy simply by defining [ForeignKey] Data Annotations.

Fortunately, a quick search turned up this Stack Overflow thread: http://stackoverflow.com/questions/5559043/entity-framework-code-first-two-foreign-keys-from-same-table

This thread ultimately resulted in 2 possible solutions to this problem.

The first solution required the usage of the FluentAPI for Entity Framework Code First by relying on the OnModelCreating event in the DbContext class:

The second solution required the use of the [InverseProperty] Data Annotation instead: