In previous articles Get enumeration items as a list in C# and Populate dropdown with enumeration items in ASP.NET Core we that saw how to get enumeration items as a collection to bind it to data controls like dropdown etc.
In this article we will see that how can we get the description given as an attribute with an item. We may need this information on various places, say we have listing of users and we need to show each user’s status but in a descriptive way.

Here is our example enumeration:

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

Sometime we need to fetch the information about the tables defined in an SQL Server database, we can fetch this information using the following query:

SELECT * FROM sys.tables

It will show information about all the tables in database.

You can use the following query to get the count number of tables in the database:

SELECT count(*) FROM sys.tables

Use the following query to get matching table names:

SELECT * FROM
 ...  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
 ...  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

 ...  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
 ...  read more