Sometime we need to get enumeration items as a list to bind it to some data controls like drop downs.

Here is how we can do that. Suppose we have following enumeration:

 enum UserStatus
        PendingVerification = 1,
        PendingAdminApproval = 2,
        Active = 3,
        BlockedByAdmin = 4

We want to bind a dropdown on manage users page with these items. As you know dropdown have two properties for each item, one to handle display value and the other to handle backend value.

Using the current definition of enumeration we can use the name of enumeration item as display property and underlying integer value as backend value but it will not look good as there will be no space between words like PendingVerification. It will be more readable if it is Pending Verification.

So let’s add Description attribute to the enumeration items. Updated enumeration will look like this:

    enum UserStatus
        [Description("Pending Verification")]
 ...  read more

While developing Angular applications in Visual Studio 2019 & Visual Studio Code following compile time error is shown:

TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Specify ‘–experimentalDecorators’ to remove this warning.

Visual Studio Fix:

I am using Visual Studio 2019 and fixed the issue in it, it might work in other versions as well.

Add the following lines in .csproj file:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">    
 ...  read more

Microsoft Office 365 will no more support to connect using TLS1.0 and TLS1.1, please read it here.

All the browser-server or client-server applications must use TLS1.2 or later to be able communicate with Office 365 services.

Here is how we can implement it in C# to connect using TLS1.2, put the following line of code either in the constructor of the class which you are using to communicate with the Office 365 services or in the method directly:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;          

As more and more service providers like PayPal and others or switching to support TLS1.2 only, you can put above line of code before calling any web service or API which supports TLS1.2 only.

If your service provider supports more than one security protocol you can mention it like below:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

If you are using .NET Framework version older than 4.5 then use the following code:

 ...  read more

In this article we will see the step by step process to move JIRA from on-premises or virtual machine to Microsoft Azure VM.

  1. Backup from the existing installation
  2. Provision Azure VM (if you don’t have already)
  3. Install JIRA on Azure VM but don’t run it
  4. Restore JIRA home folder
  5. Create new database
  6. Run JIRA
  7. Restore database

1. Backup from the existing installation

First take the database backup, login as administrator, go to System menu and click on Import & Export ...  read more

More and more companies are using cloud infrastructure to host their applications and databases. In this article we will discuss the high level steps to move on-premises SQL Server database to Azure SQL database using Microsoft SQL Server Management Studio:

  1. Download and install the latest version of Microsoft SQL Server Management Studio, old version can give unexpected errors as now Azure SQL databases have almost same set of features as on-premises databases can have.
  2. Right click on

 ...  read more

ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data – Microsoft

Normally server sends notifications to clients when communication is initiated by some client but there are situations when we want server to push data to clients even there is no request from any clients.
Here is step by step procedure to do so.

[the_ad id=”181″]

Step 1
Add hub class, right click (on the App_Code in case of website project or appropriate folder in case of web application project), select Add and then Add New Item. Select the SignalR Hub Class template, give it a name say BroadcasterHub and click Add.
Your class should look like below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;

public class BroadcasterHub : Hub {
 ...  read more

Sometime we need to do undo checkout from other user’s workspace in Team Foundation Server (TFS). Here is the procedure to do it using Visual Studio’s Command Prompt.
Open the Visual Studio Command Prompt and type the following command:

tf undo /workspace:"WorkspaceName;WorkspaceOwnerName" $/Project/SomeFile.aspx 

Replace the workspace and workspace owner’s name and also path of the file to undo checkout.

You must have “Undo other users’ changes” permission to perform this. When you will execute this command it might prompt for your TFS credentials (if those were not saved/remembered).

Tip: You can use the above command to undo checkout a file from your own workspace.

Tip: To get the workspace and owner names and file path, try to check out the same file in Visual Studio it will provide this information in output window, copy from there and replace in the above command and execute it.

Tip: You can undo check out all the files in project or specific directory by add /recursive parameter in the command, please see the example below:
Example 1

tf undo /workspace:"WorkspaceName;WorkspaceOwnerName" $/Project /recursive

Example 2

tf undo /workspace:"WorkspaceName;WorkspaceOwnerName"

 ...  read more